3
Analyzing a code built on the Nodejs platform, I came across the instruction express.urlencoded({ extended: false })
, to try to understand it, I ended up using the Expressjs documentation, however I could not understand what it means, does and what its importance in the code.
I would be grateful if someone could answer the questions raised in the above text. As well as comment on the relevance of { Extended: false }
I understood, and what the meaning of
express.urlencoded
? It is a middleware to handle parameters in the URL?– Fábio Jânio
Actually the middleware is the body-parser, you install it as the express module to give the express the ability to analyze the content of requests before we do some manipulation. (in a nutshell he makes the body content of the requests all cute for us to work easier this data) and urlencoded is a method of that middleware that can receive parameters, as the Extended we speak, other parameters that it accepts you find there in the link I left.
– Murilo Portugal
@Muriloportugal you explained a lot about the parameter
extended
but what exactly does theurlencoded
? I know that theexpress.json()
is a parser of information coming from a post request but whaturlencoded
? It would be to parse parameters passed in the URL such as "http://site.com/name=Lucas" ?– JeanExtreme002
@Jeanextreme002 o
urlencoded
is a parser of the information coming in the request body. See documentation– Murilo Portugal