Miss any of our Open RFC calls?Watch the recordings here! »

koa-accepts

0.6.0 • Public • Published

koa-accepts

CircleCI

Simple middleware to change the format of your response based on the HTTP accept header, using q weights via the negotiator library.

Supported formats:

  • application/yaml: YAML
  • application/x-msgpack: MsgPack
  • application/json: JSON.stringify
  • application/xml,text/xml: XML

If anything else it will fall back to doing what koa normally does (JSON).

Quickstart

import * as koa from 'koa'
import accepts from 'koa-accepts'
 
const app = new Koa()
 
app.use(accepts())

Install

npm i [email protected]

Version

0.6.0

License

MIT

Unpacked Size

17.3 kB

Total Files

26

Last publish

Collaborators

  • avatar