There's more...

Some requests provide more than simple URL paths and query parameters to a web server. They might provide a whole request body that contains rich content. By default, Express comes preconfigured with a middleware library called body-parser that will read both JSON and URL-encoded form content. The values of this body content will be available on the request object as a body property:

route.post('/post', function (req, res) {
if (!req.body) return res.sendStatus(400)
res.send('New Post, ' + req.body.title)
})

There are many complexities to consider when working with a large body content in HTTP requests. To learn more about body-parser and how to use it for reading body content in Express, check out the official documentation on GitHub at https://github.com/expressjs/body-parser.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.237.77