본문 바로가기

express

body-parser[Middleware]

body-parser:

Parse incoming request bodies in a middleware before your handlers, available under the req.body property.

when you use body-parser, you need to put any options. if you dont, you will get a sentence like "body-parser deprecated undefined extended: provide extended option"

so we usually put ".urlencoded({ extended: true or false })" this means

if "extended : true", this means req.body is the 'application/x-www.form.urlencoded' type.

"x-www.form.urlencoded" type makes datas to "key : value"