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!'
//     }
//   ]
// }

Readme

Keywords

Package Sidebar

Install

npm i boom-to-json-api

Weekly Downloads

5

Version

1.0.0

License

ISC

Last publish

Collaborators

  • robinmurphy