- 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
andPUT
requests - Create a url parser that returns a promise and uses nodes
url
andquerystring
modules parse the request url - Create a Router Constructor that manages requests to
GET
,POST
,PUT
, andDELETE
requests - Create a route for doing
CREATE
,READ
, andDELETE
operations on your simple resource - Create a storage module that will store resources by their type and id
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 foundGET
- test 400, responds with 'bad request' if no id was provided in the requestGET
- test 200, response body like{<data>}
for a request made with a valid idPOST
- test 400, responds with 'bad request' for if nobody provided
orinvalid 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