Socket
Socket
Sign inDemoInstall

req-parser

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    req-parser

A middleware function for parsing request bodies in Express.js. It automatically detects the content type and parses the body accordingly.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
2.59 kB
Created
Weekly downloads
 

Readme

Source

req-parser

npm dependents install size Downloads NPM Version run on repl.it

A lightweight and flexible middleware for parsing the request body in Express.

Installation

Install with npm:

npm install req-parser

Usage

const express = require("express");
const bodyParser = require("req-parser");

const app = express();

// Use bodyParser middleware
app.use(bodyParser);

// Handle POST requests
app.post("/", (req, res) => {
  console.log(req.body);
  res.send("Got it!");
});

app.listen(3000, () => {
  console.log("Server listening on port 3000");
});

Options The middleware automatically detects the content type of the request body and parses it accordingly. Supported content types are:

  • application/json
  • application/x-www-form-urlencoded
  • any other content type (treated as plain text)

License ISC

Keywords

FAQs

Last updated on 31 Mar 2023

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