Father of four under four, three boys and one girl! Full-Stack dev programming mostly in Javascript/TypeScript these days, with a decent amount of Rust on the side
This is a built-in middleware function in Express. It parses incoming requests with JSON payloads and is based on body-parser.
Returns middleware that only parses JSON and only looks at requests where the Content-Type header matches the type option. This parser accepts any Unicode encoding of the body and supports automatic inflation of gzip and deflate encodings.
A new body object containing the parsed data is populated on the request object after the middleware (i.e. req.body), or an empty object ({}) if there was no body to parse, the Content-Type was not matched, or an error occurred.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I think, express.json() is to parse header body which is json. Body parser is also to parse form data. Please correct me if im wrong.
As per the Express docs