POST request From Express js

How to handle POST requests in Express.

POST HTTP request uses the POST method and is mostly used when sending some data along with the request to the HTTP server. In Express you’ll need to enable a middleware to parse the body of Content-type: application/json. This enables parsing incoming JSON content in the body of the incoming request.

Values sent in the POST request are populated inside the req.body object.

app.get('/groceries',(req,res)=>{
 response.send(groceryList);
});

app.post('/groceries',(req,res)=>{
    console.log(request.body);
    response.send(201);
}); You can use , Thunder Client OR Postman to POST JSON Data..