Node.js body parsing middleware. Parse incoming request bodies in a middleware before your handlers, available under the req.body property. As req.body's shape is based on user-controlled input, all properties and values in this object are untrusted and should be validated before trusting. For example, req.body.foo.toString() may fail in multiple ways, for example the foo property may not be there or may not be a string, and toString may not be a function and instead a string or other user input. The bodyParser object exposes various factories to create middlewares. All middlewares will populate the req.body property with the parsed body when the Content-Type request header matches the type option, or an empty object ({}) if there was no body to parse, the Content-Type was not matched, or an error occurred.

Features

  • Control the maximum request body size
  • Add a generic JSON and URL-encoded parser as a top-level middleware
  • Add body parsers specifically to the routes that need them
  • Parse the bodies of all incoming requests
  • All the parsers accept a type option which allows you to change the Content-Type that the middleware will parse
  • Change accepted type for parsers

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow body-parser

body-parser Web Site

Other Useful Business Software
Our Free Plans just got better! | Auth0 Icon
Our Free Plans just got better! | Auth0

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your security. Auth0 now, thank yourself later.
Try free now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of body-parser!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Parser Generators

Registered

2021-11-01