Routers can be created according to REST principles such as get, post, put, delete etc..
GET => get request to retrieve data from database or data store(An array).POST => post request to insert data to database or data store(An array).PUT => put request to update the data in database or data store(An array).DELETE => delete request to delete data in database or data store(An array).
Creation of routers.
In this scenario I have created a schema call users using mongoose.
using mongoose the created users model is retrieved. |
GET request
using the keyword "get" the data can be retrieved.
retrieving all the users in the database. |
By giving a parameter in the url we can get information according to the given subject.
user is retrieved according to the _id. |
POST request
using the keyword "post" the data can be inserted.
users are inserted to the database. |
PUT request
using the keyword "putt" the data can be updated.
user is updated according to the _id. |
DELETE request
using the keyword "delete" the data can be deleted.
user is deleted according to the _id. |
Comments
Post a Comment