req-parser

1.0.3 • Public • Published

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

/req-parser/

    Package Sidebar

    Install

    npm i req-parser

    Weekly Downloads

    2

    Version

    1.0.3

    License

    ISC

    Unpacked Size

    2.65 kB

    Total Files

    3

    Last publish

    Collaborators

    • tyler09456