Files
Harkirat Singh e202b917d6 Update index.md (#35323)
* Update index.md

Completion of solution code.

* Update guide/english/certifications/apis-and-microservices/basic-node-and-express/get-data-from-post-requests/index.md

Co-Authored-By: Harkirat155 <harkirat.hira@gmail.com>

* Update guide/english/certifications/apis-and-microservices/basic-node-and-express/get-data-from-post-requests/index.md

Co-Authored-By: Harkirat155 <harkirat.hira@gmail.com>
2019-02-21 09:32:41 -08:00

970 B

title
title
Get Data from POST Requests

Get Data from POST Requests

Just like using req.query we can do req.body to get our data. This challenge is very similar to "Get Query Parameter Input from the Client."

In order to get data from a post request a general format is:

Hint

app.post(PATH, function(req, res) {
  // Handle the data in the request
});

Solution

app.post('/name', function(req, res) {
  // Handle the data in the request
  var string = req.body.first+ ' '+req.body.last;
  res.json({"name": string});
});

Help our community expand these hints and guides.