Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does 'extended' mean in express 4.0?

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

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

But, What does 'extended' mean in express 4.0?

I found this

extended - parse extended syntax with the qs module. 

However, I still can't understrand what it means.

like image 351
KimCrab Avatar asked Apr 30 '15 06:04

KimCrab


People also ask

What is extended in Express?

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.

What is express JSON ()?

json() is a built-in middleware function in Express. This method is used to parse the incoming requests with JSON payloads and is based upon the bodyparser. This method returns the middleware that only parses JSON and only looks at the requests where the content-type header matches the type option.


1 Answers

If extended is false, you can not post "nested object"

person[name] = 'cw'  // Nested Object = { person: { name: cw } } 

If extended is true, you can do whatever way that you like.

like image 170
Wayne Chiu Avatar answered Sep 30 '22 23:09

Wayne Chiu