yeps-body
v1.1.1
Published
YEPS Parse request bodies with async / await
Downloads
2
Maintainers
Readme
YEPS body
Parse request bodies with async / await
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.