In this assignment we will be writing a simple REST API. Both GET and POST methods will be used
- Clone the Repo
- Complete the assigned coding tasks. Commit OFTEN!
- Push to your repo
For this assignment you will be writing a simple REST API. You will need 3 API routes (URI's) 2 GET routes and 1 POST route. All the routes will return JSON formated data.
Using the express framework you will need to create the following routes:
A HTTP GET request will return any JSON formated data. Typically this is a validation message to make sure the user is accessing the API correctly
A HTTP GET request should return a JSON object with a data property and some fake data.
A HTTP POST request should return a JSON object with a query property containing the data request.
An example for the HTTP POST request: POST data:
{"data" : "QueryGoesHere" }
The API would return:
{"query" : "QueryGoesHere"}
- Don't forget to
npm installafter cloning 😛 - Use
npm startto start the server. This will use a command line tool called nodemon. Nodemon will watch for changes in the project folder and restart the server AUTOMATICALLY when you save a file. 😄 - Use ````npm test``` to run the tests.
- When in doubt. Google it.