Skip to content

robinjmurphy/boom-to-json-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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: '404',
//       title: 'Not Found',
//       detail: 'Sorry, nothing to see here!'
//     }
//   ]
// }

About

Formats a Boom error according to the JSON API spec

Resources

Stars

Watchers

Forks

Packages

No packages published