-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathnode.txt
More file actions
24 lines (19 loc) · 1.97 KB
/
Copy pathnode.txt
File metadata and controls
24 lines (19 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
EASY: Create a node application that will read all of the planets in the solar system from a text file and print them to the console.
Text file: mercury,venus,earth,mars,jupiter,saturn,uranus,neptune,pluto (I still believe in you pluto)
MEDIUM: Create a JSON file that will have 10 employees in it, their employeeID, their name, their salary and department name.
Then, create an express API so that when you hit the endpoint with a GET request we want the api to respond with all data on the employees.
If you hit the endpoint with their employeeID, we want to hand up only the information on that one employee.
If you hit the endpoint with an incorrect employeeID, send back the correct HTTP status code and an error message stating that the employee was not found.
GET::myendpointname.com/employees = Json with information from all 10 employees.
GET::myendpointname.com/employees/<employeeID> = Json with the information from that specific employee.
HARD: Add the remaining CRUD functionality to your medium problem.
Mak yoe sureu return the proper HTTP status codes based on the outcome of the request. Be sure to implement error checking here.
If an invalid request is made, we want to return some sort of error message and the correct HTTP status code for the situation.
HTTP Status Codes: http://www.restapitutorial.com/httpstatuscodes.html
POST::myendpointname.com/employees = Inserts new employee into your data.
GET::myendpointname.com/employees = Returns json with information from all employees.
GET::myendpointname.com/employees/<employeeID> = Returns json with the information from that specific employee.
PUT::myendpointname.com/employees/<employeeID> = Updates information for specified employee.
DELETE::myendpointname.com/employees/<employeeID> = Removes the employee with that ID from the data.
*** At the beginning of your API code, please comment in your endpoints so that I can test your code via Postman.
You can use a similar technique as the one shown above in the API design.