What does 'extended' mean in express 4.0?

后端 未结 3 2038
有刺的猬
有刺的猬 2020-11-28 02:57

I\'m using express and also body-parser in my app.

app.use(bodyParser.urlencoded({ extended: false }));

But, What does \'extended\' mean in

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 03:15

    From the Body-Parser docs:

    A new body object containing the parsed data is populated on the request object after the middleware (i.e. req.body). This object will contain key-value pairs, where the value can be a string or array (when extended is false), or any type (when extended is true).

    And

    The extended option allows to choose between parsing the URL-encoded data with the querystring library (when false) or the qs library (when true). The "extended" syntax allows for rich objects and arrays to be encoded into the URL-encoded format, allowing for a JSON-like experience with URL-encoded. For more information, please see the qs library.

    Basically extended allows you to parse full objects.

    Body Parser: Url Encoded

提交回复
热议问题