Socket
Socket
Sign inDemoInstall

@types/body-parser

Package Overview
Dependencies
11
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/body-parser

TypeScript definitions for body-parser


Version published
Weekly downloads
19M
decreased by-8.78%
Maintainers
1
Install size
804 kB
Created
Weekly downloads
 

Package description

What is @types/body-parser?

The @types/body-parser package contains TypeScript definitions for the body-parser package. Body-parser is a middleware used in Express applications to parse incoming request bodies before your handlers, available under the req.body property. It supports parsing of JSON, raw, text, and URL-encoded form bodies. The @types/body-parser package doesn't provide functionality by itself but offers type definitions to enable TypeScript developers to use body-parser in a type-safe manner.

What are @types/body-parser's main functionalities?

JSON Body Parsing

Parses incoming request bodies in a middleware before your handlers, available under the req.body property, assuming the Content-Type header of the request is application/json.

import * as bodyParser from 'body-parser';
import express from 'express';

const app = express();

app.use(bodyParser.json());

app.post('/json', (req, res) => {
  res.send(req.body);
});

URL-Encoded Form Body Parsing

Parses incoming request bodies with URL-encoded data (like form submissions) before your handlers, making the form data available under the req.body property.

import * as bodyParser from 'body-parser';
import express from 'express';

const app = express();

app.use(bodyParser.urlencoded({ extended: true }));

app.post('/form', (req, res) => {
  res.send(req.body);
});

Other packages similar to @types/body-parser

Readme

Source

Installation

npm install --save @types/body-parser

Summary

This package contains type definitions for body-parser (https://github.com/expressjs/body-parser).

Details

Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser

Additional Details

  • Last updated: Wed, 08 Nov 2017 22:15:33 GMT
  • Dependencies: express, node
  • Global values: none

Credits

These definitions were written by Santi Albo https://github.com/santialbo, Vilic Vane https://github.com/vilic, Jonathan Häberle https://github.com/dreampulse, Gevik Babakhani https://github.com/blendsdk, Tomasz Łaziuk https://github.com/tlaziuk.

FAQs

Last updated on 08 Nov 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc