2.1.0 • Published 11 years ago
hal-body v2.1.0
hal-body
Parse hal+json body using halson and co-body.
Installation
$ npm install hal-bodyOptions
Available via raw-body:
limitnumber or string representing the request size limit (1mb for json)
Example
var parseHal = require('hal-body');
// application/hal+json
var resource = yield parseHal(req);
console.log(resource.title));
console.log(resource.getLink('self'));Koa
This lib also supports ctx.req in Koa (or other libraries),
so that you may simply use this instead of this.req.
var parseHal = require('hal-body');
// application/hal+json
var resource = yield parseHal(this);
console.log(resource.title);
console.log(resource.getLink('self'));License
MIT