hal-body

2.1.0 • Public • Published

hal-body

Build Status

Parse hal+json body using halson and co-body.

Installation

$ npm install hal-body

Options

Available via raw-body:

  • limit number 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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.1.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.1.0
    1
  • 2.0.2
    0
  • 2.0.1
    0
  • 2.0.0
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i hal-body

Weekly Downloads

1

Version

2.1.0

License

MIT

Last publish

Collaborators

  • jerrymf