Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uws-body-parser

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uws-body-parser

A request body parser middleware for uWebSockets.js

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

uws-body-parser

uws-body-parser is a request body parsing middleware for uWebSockets.js.

Typical usage

const { App } = require('uWebSockets.js');

const { bodyParser } = require('uws-body-parser');

const app = App();

app.post('/my/api/endpoint', (res, req) => {
  bodyParser(res, req, (data, wasParsed) => {
      // `wasParsed` argument is a boolean indicating if the body was actually parsed
      if (!wasParsed) {
        console.log('Body not parsed!');
      }
      // `data` argument is the parsed JSON/xWwwFormUrlEncoded/Raw Buffer body
      console.log(data);
      // TODO: your logic here
    }, () => { console.error('request aborted'); }
  );
});

FAQs

Package last updated on 06 May 2021

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc