What does body-parser do with express?

Edit: in 2019-april-2
in express@4.16.0 the body-parser middleware is included in express, so you don’t need to install body-parser separately anymore. for more details see this

OLD:

To handle HTTP POST requests in Express.js version 4 and above, you need to install the middleware module called body-parser.

body-parser extracts the entire body portion of an incoming request stream and exposes it on req.body.

The middleware was a part of Express.js earlier but now you have to install it separately.

This body-parser module parses the JSON, buffer, string and URL encoded data submitted using HTTP POST request. Install body-parser using NPM as shown below.

npm install body-parser --save

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)