You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
POST /comments
PUT /comments/:id
DELETE /comments/:id
GET /clients
For a description of each of these endpoints, see the DB model.
Follow proper API conventions and return status codes along with your response. Namely 200, 404, 500, etc.
Put your endpoints into /server/routes/[FILENAME].js
Replace FILENAME with the name of the DB table that the endpoint is for.
Don't Forget: use the keysToCamel function, as seen in the sample users.ts file, to make the SQL keys into camel case
Some sample files have been provided. They are in TS not JS, but you can ignore the TS stuff (and work in JS)
Steps
Create file for each endpoint (comments/clients)
Create a router for this file (see examples)
Import and place this router into /server/src/App.ts (see line 40)
Create the functions for get/post/delete/put
Example
GET /users/:id
Place this into /server/routes/users.js
See users.ts for the best examples.
Testing
To test your implementation, you can use Postman like we have in the bootcamps.
If you put your endpoints in sample.js (for example only), then you will need to send requests to: 127.0.0.1:3001/sample/<your endpoint>
Setup
Before you can work on the repo, you need to add the secrets.
For the Frontend .env, put it in /client.
For the Backend .env, put it in /server.
You also need to add this file in /server/config
Task
Create the following API endpoints:
For a description of each of these endpoints, see the DB model.
Follow proper API conventions and return status codes along with your response. Namely 200, 404, 500, etc.
Put your endpoints into
/server/routes/[FILENAME].js
Replace FILENAME with the name of the DB table that the endpoint is for.
Don't Forget: use the keysToCamel function, as seen in the sample users.ts file, to make the SQL keys into camel case
Some sample files have been provided. They are in TS not JS, but you can ignore the TS stuff (and work in JS)
Steps
Example
GET /users/:id
Place this into
/server/routes/users.js
See
users.ts
for the best examples.Testing
To test your implementation, you can use Postman like we have in the bootcamps.
If you put your endpoints in sample.js (for example only), then you will need to send requests to:
127.0.0.1:3001/sample/<your endpoint>
Resources
Secrets (.env)
PostgreSQL DB Login
DB Schema
Checklist
The text was updated successfully, but these errors were encountered: