This an example of Rest framework api built using express.js. This should be tested with POSTMAN.
-
GET: URL : https://l1w5qlr3ke.execute-api.us-east-1.amazonaws.com/dev/books Body: Not required Response: List of all the books present in the database
-
POST: URL: https://l1w5qlr3ke.execute-api.us-east-1.amazonaws.com/dev/books Body: In postman select body->choose raw option -> Json format. Example data to be inserted in the body.
{ "name" : "name of the book", "price" : "price of that book", "author" : "author of that book" }
Response:{ "_id": "unique id generated", name" : "name of the book", "price" : "price of that book", "author" : "author of that book" }
-
Patch (requires book id): URL: https://l1w5qlr3ke.execute-api.us-east-1.amazonaws.com/dev/books/{id} Body: In postman select body->choose raw option -> Json format. Example data to be inserted in the body.
{ "name" : "name of the book", "price" : "price of that book", "author" : "author of that book" }
(All fields are required during updation too) -
GET (particular book): URL : https://l1w5qlr3ke.execute-api.us-east-1.amazonaws.com/dev/books/{id} Body: Not required Response: information about that book
-
DELETE (requires book id): URL : https://l1w5qlr3ke.execute-api.us-east-1.amazonaws.com/dev/books/{id} Body: Not required