Database Schema & Backend Routes - dhoffmann1/Rides GitHub Wiki

Database Schema

image

Backend Routes

Users

GET /api/users/

  • Returns the information for all users

GET /api/users/:id

  • Returns the information for one user including their garage (cars they have for sale)

Sessions

GET /api/auth/

  • Returns the information for the logged in user

POST /api/auth/signup

  • Signs a new user up

POST /api/auth/login

  • Logs in a user

DELETE /api/auth/

  • Logs out a user

Cars

GET /api/cars/

  • Returns the information for all cars

POST /api/cars/

  • Creates a new car

GET /api/cars/:id

  • Returns the information for one car

PUT /api/cars/:id

  • Updates a car

DELETE /api/cars/:id

  • Deletes a car

Reviews

GET /api/cars/:id/reviews

  • Returns the reviews for a car

POST /api/cars/:id/reviews

  • Creates a new review for a car

PUT /api/reviews/:id

  • Edits the information for one review

DELETE /api/reviews/:id

  • Deletes a review

Images

GET /api/cars/:id/images

  • Returns the images for a car

POST /api/images

  • Creates a new image

DELETE /api/images/:id

  • Deletes an image

Bonus Routes Below

Car Features

GET /api/cars/:id/features

  • Return all the features of a car

POST /api/cars/:id/features

  • Add a feature to a car

DELETE /api/cars/features/:id

  • Remove a feature from a car

Saved Cars

GET /api/users/:id/saved-cars

  • Returns the saved cars for a user

POST /api/cars/:id/saved-cars

  • Adds a new saved car to a user

DELETE /api/cars/:id/saved-cars

  • Removes a car from the user's saved cars list