View Code? Open in Web Editor
NEW
This project forked from codefellows-seattle-javascript-401d10/lab-08-09-single-resource-api
lab-08-09-single-resource-api
Shell 10.02%
JavaScript 89.98%
lab-08-09-single-resource-api's Introduction
lab-08-single-resource-api
To Submit this Assignment
- fork this repository
- write all of your code in a directory named
lab-
+ <your name>
e.g. lab-duncan
- push to your repository
- submit a pull request to this repository
- submit a link to your PR in canvas
- write a question and observation on canvas
- create a package.json that lists all dependencies and developer dependencies
- include an .eslintrc
- include a .gitignore
- include a readme with project description
- create a gulpfile
- Create these directories to organize your code:
- lib
- model
- test
- Create a HTTP Server using the http module
- Create a Object Constructor that creates a simple resource with at least 3 properties
- An
id
property that is set to a unique node-uuid id is required
- Also include two other properties of your choice (like name, creationDate, etc.)
- Create a body parser that uses Promises to parse the json in the body of
POST
and PUT
requests
- Create a url parser that returns a promise and uses nodes
url
and querystring
modules parse the request url
- Create a Router Constructor that manages requests to
GET
, POST
, PUT
, and DELETE
requests
- Create a route for doing
CREATE
, READ
, and DELETE
operations on your simple resource
- Create a storage module that will store resources by their type and id
/api/simple-resource-name
POST
request
- pass data as stringifed json in the body of a post request to create a resource
GET
request
- pass an
?id=<uuid>
in the query string to retrieve a specific resource as json
DELETE
request
- pass an
?id=<uuid>
in the query string to delete a specific resource
- should return 204 status with no content in the body
- 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/simple-resource-name
endpoint responds as described for each condition below:
GET
- test 404, responds with 'not found' for valid request made with an id that was not found
GET
- test 400, responds with 'bad request' if no id was provided in the request
GET
- test 200, response body like {<data>}
for a request made with a valid id
POST
- test 400, responds with 'bad request' for if no body provided
or invalid body
POST
- test 200, response body like {<data>}
for a post request with a valid body
- 2pts a
GET
request to /api/simple-resource-name
with no ?id= should retrun an array of all of the ids for that resource
lab-08-09-single-resource-api's People
Contributors
Watchers