Build a REST API using Express, by creating a proper series of endpoints that perform CRUD operations on a Postgres SQL Database, using the REST standard.
- Make a POST request to the/signup route with username and password.
- Your server should support both JSON and FORM data as input.
- On a successful account creation, return a 201 status with the user object in the body.
- On any error, trigger your error handler with an appropriate error.
- Make a POST request to the /signin route.
- Send a basic authentication header with a properly encoded username and password combination.
- On a successful account login, return a 200 status with the user object in the body.
- On any error, trigger your error handler with the message “Invalid Login”.
- CRUD Operation: Read
- REST Method: GET
- Path: /food/1
- Returns: The object from the database, which has the id matching that which is in the path.
Referenced Ryan Gallaway's Demo Code Help on associations from Aaron Imbrock
Port variable located within .env.sample
- e.g.
npm start
Clone repo, npm i
, npm run db:create
, then run nodemon
in terminal
- Feature One: Details of feature
- POST :
/signup
- POST :
/signin