Socket
Socket
Sign inDemoInstall

@octoris/body-parser

Package Overview
Dependencies
27
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @octoris/body-parser

A body parser middleware for octoris


Version published
Maintainers
1
Install size
0.989 MB
Created

Changelog

Source

v0.1.2

  • Dependency Updates for audit

Readme

Source

body-parser

A body parser middleware for octoris

Install

npm i @octoris/body-parser

json(opts)

The json parser for handling json payloads

Options

  • strict: when set to true, JSON parser will only accept arrays and objects; when false will accept anything JSON.parse accepts. Defaults to true. (also strict mode will always return an object)
  • limit: Number or string representing the request size limit. Defaults to 1mb
  • encoding: The content encoding type. Defaults to utf8

Usage

const { router, response, methods} = require('octoris')
const { json } = require('@octoris/body-parser')

function handler () {
  return new Promise(resolve => send(200, 'Okay!'))
}

const home = router.route([router.fixed('/')], [methods.GET(handler)])

router.composeRoutes({}, [home], [json()])

form(opts)

Form parser for handling url-encoded form payloads

Options

  • queryString: An options object that is passed directly to the qs module
  • limit: A number or string representing the request size limit. Defaults to 56kb
  • qs: The querystring function you'd like to use. Defaults to qs
  • encoding: The content encoding type. Defaults to utf8

Usage

const { router, response, methods} = require('octoris')
const { form } = require('@octoris/body-parser')

function handler () {
  return new Promise(resolve => send(200, 'Okay!'))
}

const home = router.route([router.fixed('/')], [methods.GET(handler)])

router.composeRoutes({}, [home], [form()])

Keywords

FAQs

Last updated on 08 Apr 2022

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