Question: You will store the data in MongoDB in a collection named exercises. Each document in the collection must have the following properties ( i .

You will store the data in MongoDB in a collection named exercises. Each document in the collection must have the following properties (i.e.,
all properties are required):
REST API Web Service
You must implement a REST API that supports CRUD operations by implementing the following 5 endpoints. Note: you can assume that the
requests will have valid data.
Create using POST /exercises
Request
The request body will be a JSON object with all the 5 properties listed in the data model.
The date property will be in the format MM-DD-YY, e.g.,06-24-21.
You can assume that all the properties are valid.
The POST request will have no path parameters.
Response
A JSON object with all the properties of the document including the unique ID value generated by MongoDB.
The content-type of the response must be application/json .
The status code must be 201.
Read all using GET /exercises
Request
No request body and no path parameters.
Response
A JSON array containing the entire collection.
Each document in the collection must be a JSON object with all the properties of the document including the ID.
The content-type of the response must be application/json .
The status code must be 200.
Read one using GET /exercises/:id
Request
The path parameter will contain the ID of the document. You can assume that a document exists with this ID.
The GET request will not have a body.
Response
A JSON object containing the document with the ID provided as the path parameter.
This JSON object must have all the properties of the document including the ID.
The content-type of the response must be
The status code must be 200.
Update using PUT /exercises/:id
Request
The request body will be a JSON object with all the 5 properties listed in the data model.
The date property will be in the format MM-DD-YY, e.g.,
You can assume that all the properties are valid.
The path parameter will contain the ID of a document. You can assume that a document exists with this ID.
Response
A JSON object with all the properties of the updated document including the ID.
The content-type of the response must be application/json .
The status code must be 200.
Delete using DELETE /exercises/:id
Request
The path parameter will contain the ID of the document. You can assume that a document exists with this ID.
The DELETE request will not have a body.
Response
The status code must be 204.
 You will store the data in MongoDB in a collection named

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!