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

@curveball/bodyparser

Package Overview
Dependencies
Maintainers
4
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@curveball/bodyparser

A curveball middleware for parsing JSON and Text bodies.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9K
increased by27.83%
Maintainers
4
Weekly downloads
 
Created
Source

Curveball Body Parser

This package is a middleware for Curveball. It helps parsing JSON and Text request bodies.

When this middleware is added, it will automatically read all bodies from requests that have the following values as their Content-Type header:

  • application/json
  • application/*+json
  • application/x-www-form-urlencoded
  • text/*

It sets the result of this parsing process to the context.request.body property. In the case of text bodies, it will result in a string.

In the case of JSON bodies, it will be the result of JSON.parse on the body.

Installation

npm install @curveball/bodyparser

Getting started

import { Application } from '@curveball/core';
import bodyParser from '@curveball/bodyparser';

const app = new Application();
app.use(bodyParser());


app.use( ctx => {
  // Log request bodies
  console.log(ctx.request.body);
});

API

bodyParser

The default export for this package is the bodyParser function. When called, this function returns a middleware.

Keywords

FAQs

Package last updated on 15 Jan 2024

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