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

/boom-to-json-api/

    Package Sidebar

    Install

    npm i boom-to-json-api

    Weekly Downloads

    1

    Version

    1.0.0

    License

    ISC

    Last publish

    Collaborators

    • robinmurphy