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

You Might Also Like
Sage Intacct Cloud Accounting and Financial Management Software Icon
Sage Intacct Cloud Accounting and Financial Management Software

Cloud accounting, payroll, and HR that grows with you

Drive your organization forward with the right solution at the right price. AI-powered continuous accounting and ERP to support your growth now and into the future.
Learn More
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