koa-parser
a body parser for koa. support json, form(urlencoded), multipart and text type body.
Install
Usage
const Koa = const parser = const port = 3000const app = app app appconsole
Screenshot
Options
app.useparser
-
encoding: requested encoding. Default is
utf-8
-
error: support custom error handle, Default is
false
. if koa-bodyparser throw an error, you can customize the response like:app -
json: Extended support for json parsing options, The default supported types are
['application/json', 'application/json-patch+json', 'application/vnd.api+json', 'application/csp-report']
. you can customize the type like:// json will be support default types and application/x-javascriptapp -
multipart: Extended support for multipart(form-data) parsing options, The default supported types are
['multipart/form-data']
-
text: Extended support for text parsing options, The default supported types are
['text/plain']
-
urlencoded: Extended support for urlencoded(form) parsing options, The default supported types are
['application/x-www-form-urlencoded']