boom-to-json-api

1.0.0 • Public • Published

boom-to-json-api

Build Status

Formats a Boom error according to the JSON API spec

Installation

npm install --save boom-to-json-api

Usage

const Boom = require('boom');
const convert = require('boom-to-json-api');
 
const err = Boom.notFound('Sorry, nothing to see here!');
const body = convert(err);
 
console.log(body);
// {
//   errors: [
//     {
//       status: '403',
//       title: 'Not Found',
//       detail: 'Sorry, nothing to see here!'
//     }
//   ]
// }

Versions

Current Tags

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

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    1

Package Sidebar

Install

npm i boom-to-json-api

Weekly Downloads

1

Version

1.0.0

License

ISC

Last publish

Collaborators

  • robinmurphy