yeps-body

1.1.1 • Public • Published

YEPS body

Parse request bodies with async / await

NPM

npm version Build Status Coverage Status Linux Build Windows Build

Dependency Status devDependency Status NSP Status

License GitHub stars GitHub forks GitHub issues Twitter

How to install

npm i -S yeps-body

How to use

const App = require('yeps');
const parse = require('yeps-body');
const app = new App();

app.then(async (ctx) => {
    ctx.res.statusCode = 200;
    ctx.res.end(JSON.stringify(await parse.any(ctx.req)));
});

Text

parse.text(ctx.req)

JSON

parse.json(ctx.req)

parse.json(ctx.req, { strict: true })

Form

parse.form(ctx.req)

parse.form(ctx.req, { queryString: { depth: 1 }})

parse.form(ctx.req, { queryString: { allowDots: false }})

See queryString parameters.

YEPS documentation

Dependencies:

  • qs - A querystring parsing and stringifying library with some added security
  • inflation - Automatically unzip an HTTP stream
  • raw-body - Parsing request bodies
  • type-is - Infer the content-type of a request

Package Sidebar

Install

npm i yeps-body

Weekly Downloads

1

Version

1.1.1

License

MIT

Last publish

Collaborators

  • evheniy.bystrov