- submit a pull request to this repository
- submit a link to your PR in canvas
- write a question and observation on canvas
- write how many hours you spent on canvas
- create a package.json that lists all dependencies and developer dependencies
- include an .eslintrc
- include a .gitignore
- include a readme with a project description
- include npm scripts
- test - to run mocha
- start - to start the server
- Create a Bearer Auth middleware parser
- Create a resource that has at least three properties
- must have a property
userID
that references the_id
of the user that created the resource - the
userID
property can only be set from an_id
found using the Bearer Auth Middleware - use the
body-parser
express middleware to onPOST
andPUT
routes - use the npm
debug
module to log the functions being executed in your app - using the express
Router
create routes for doing RESTFUL CRUD operations on your resource
POST
request- pass data as stringified json in the body of a post request to create a resource
GET
request- pass the id of a resource though the url endpoint to
req.params
to fetch a resource PUT
request- pass data as stringified json in the body of a put request to update a resource
DELETE
request- pass the id of a resource though the url endpoint to
req.params
to delete a resource
- your tests should start your server when they begin and stop your server when they finish
- write a test to ensure that your api returns a status code of 404 for routes that have not been registered
- write tests to ensure your
/api/resource-name
endpoint responds as described for each condition below: GET
- test 200, response body like{<data>}
for a request made with a valid idGET
- test 401, responds with 'unauthorized' if no token was providedGET
- test 404, responds with 'not found' for valid request made with an id that was not foundPUT
- test 200, response body like{<data>}
for a post request with a valid bodyPUT
- test 401, responds with 'unauthorized' if no token was providedPUT
- test 400, responds with 'bad request' forinvalid body
PUT
- test 404, responds with 'not found' for valid request made with an id that was not foundPOST
- test 200, response body like{<data>}
for a post request with a valid bodyPOST
- test 401, responds with 'unauthorized' if no token was providedPOST
- test 400, responds with 'bad request' for if nobody provided
orinvalid body
- 1pt a
GET
request to/api/resource-name
should return an array of all of the ids for that resource - 1pt write tests for the
DELETE
request