1.0.0 • Published 8 years ago

boom-to-json-api v1.0.0

Weekly downloads
4
License
ISC
Repository
github
Last release
8 years ago

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