What does `app.use(bodyParser.json())` do?

后端 未结 3 677
渐次进展
渐次进展 2020-12-22 20:21

For:

bodyParser.urlencoded({extended: ...})

my research shows me that if extended: true, then you can parse nested objects, or

3条回答
  •  一整个雨季
    2020-12-22 20:48

    bodyParser.json returns middleware that only parses json. This parser accepts any Unicode encoding of the body and supports automatic inflation of gzip and deflate encodings.

    A new body object containing the parsed data is populated on the request object after the middleware (i.e. req.body).

提交回复
热议问题