Backend Routes - robmroy/bandvamp GitHub Wiki

Backend Routes

HTML

  • GET / StaticPagesController#root

API Endpoints

users

  • GET /api/users/:id - returns the user information needed for the user's profile page, including followed bands, and purchased albums (both with their photo URL's)

  • POST /api/users - sign up

  • PATCH /api/users/:id - edit user (photo and user description)

session

  • POST /api/session - log in
  • DELETE /api/session - log out

bands

  • GET /api/bands/:id - returns the information needed for the band page, including albums and songs and associated URLs.

  • PATCH /api/bands/:id - edit the band_name and background_color attributes of the user with the given id.

  • No POST route since band information is stored in the user table, and users are created at /api/users.

searches

  • GET /api/searches - returns bands, albums, and songs based on user input

albums

  • GET /api/albums - grabs all albums (not including music, just the info for display), for use on the frontpage. (A full-fledged website would not exactly have this.)
  • POST /api/albums - posts data for a new album
  • PATCH /api/albums/:id - updates data for an existing album

songs

  • POST /api/songs - posts data for a new song
  • PATCH /api/songs - updates data for an existing song

follows

  • POST /api/follows - creates a 'follow'-- a fan_id and band_id indicating that the associated fan follows the associated band
  • DELETE /api/follows

purchases

  • POST /api/purchases - creates a 'purchase'-- a user_id and album_id indicating that the associated user purchased the associated album