I\'m starting to learn Nest.js, so I am following an Academind Tutorial (link).
My code is not working as expected when I try to get the body
variable w
You're sending form-data
which NestJS does not correctly parse by default. You can use application/x-www-url-form-encoded
or application/json
along with the raw
option in Postman. The JSON body would look like so:
{
"id": "7",
"title": "Whatever Title",
"desscription": "whats doc",
"author": "Me"
}
And then your server will recognize the body properly. The other option would be to add in a body parser that properly parses form-data. There are several options out there like multer
, form-parser
, formidable
, and others.