BYOB is a template for setting up a database and API endpoints using Node, Express, Knex, and PostgreSQL. The template uses three related tables - Users, Companies, and Comments. The general link is that a User can submit a Comment about any given Company. The endpoints attempt to be RESTful.
GET
/api/v1/users
- returns a JSON array of all users
POST
/api/v1/users
- send user
name
to add to database. Will respond with all users.
GET
/api/v1/users/:id
- return a JSON array of a single user
PUT
/api/v1/users/:id
- Send an updated user name and return JSON array for single user
DELETE
/api/v1/users/:id
- Deletes sent user ID and returns JSON array of all remaining users
GET
/api/v1/companies
-
returns a JSON array of all companies
-
send query of state and receive only companies located in given state (ex. '/api/v1/companies?state=KY')
POST
/api/v1/companies
- send company
name
to add to database. Will respond with all companies.
GET
/api/v1/companies/:id
- return a JSON array of a single company
PUT
/api/v1/companies/:id
- Send an updated company name and return JSON array for single user
DELETE
/api/v1/companies/:id
- Deletes sent user ID and returns JSON array of all remaining companies
GET
/api/v1/comments
- returns a JSON array of all comments
POST
/api/v1/comments
- send comment
name
to add to database. Will respond with all comments.
GET
/api/v1/comments/:id
- return a JSON array of a single comment
PATCH
/api/v1/comments/:id
- Send an updated comment name and return JSON array for single user
DELETE
/api/v1/comments/:id
- Deletes sent user ID and returns JSON array of all remaining comments
GET
/api/v1/comments/total/:company_id
- Send a company ID and receive total number of associated comments
GET
/api/v1/comments/company/:company_id
- Send a company ID and receive all associated comments