🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

req-parser

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

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.

1.0.3
latest
npm
Version published
Weekly downloads
6
200%
Maintainers
1
Weekly downloads
 
Created
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

express

FAQs

Package last updated on 31 Mar 2023

Did you know?

Socket

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