📎 Webclip
You probably don't need body-parser in your Express apps
Express has included body parsing since version 4.16.0, so the extra body-parser dependency is usually unnecessary in new examples and apps. The article points to the Express docs and shows how the common setup can be simplified.
Reading notes#
- The common Express setup often installs both express and body-parser and then uses bodyParser.json().
- Express version 4.16.0 already includes body parsing support out of the box.
- The bodyParser reference can be replaced with express, which shortens the code to app.use(express.json()).
- With Babel, the code can be made even shorter by importing json from express and calling app.use(json()).
