All Projects → brainsiq → Hapi Boom Decorators

brainsiq / Hapi Boom Decorators

Licence: mit
Decorates a Hapi server's response toolkit with functions to make it easy to reply with Boom errors

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Hapi Boom Decorators

paydash
Worker payments dashboard for MGNREGA
Stars: ✭ 44 (+57.14%)
Mutual labels:  hapi
shariff-backend-node
Node.js (hapi) backend for Shariff. Shariff enables website users to share their favorite content without compromising their privacy.
Stars: ✭ 17 (-39.29%)
Mutual labels:  hapi
Frame
💡 A user system API starter
Stars: ✭ 741 (+2546.43%)
Mutual labels:  hapi
hapi-imagemin-proxy
Hapi proxy for serving optimized images
Stars: ✭ 30 (+7.14%)
Mutual labels:  hapi
graphql-tutorial
Tutorial for GraphQL
Stars: ✭ 24 (-14.29%)
Mutual labels:  hapi
Takeoff
A rapid development environment using docker for convenience.
Stars: ✭ 271 (+867.86%)
Mutual labels:  hapi
exiting
Safely shutdown http://hapijs.com servers.
Stars: ✭ 23 (-17.86%)
Mutual labels:  hapi
Typescript Seed
Typescript Seed Project (Angular, Hapi, Cookie Auth, TypeORM, Postgres)
Stars: ✭ 12 (-57.14%)
Mutual labels:  hapi
disinfect
Request query, payload, and params sanitization for Hapi
Stars: ✭ 20 (-28.57%)
Mutual labels:  hapi
Vudash
Powerful, Flexible, Open Source dashboards for anything
Stars: ✭ 363 (+1196.43%)
Mutual labels:  hapi
hapi-acl-auth
Authentication provider agnostic authorization plugin for HapiJS
Stars: ✭ 22 (-21.43%)
Mutual labels:  hapi
hapi-cron
🕰️ Cron jobs for internal hapi.js routes
Stars: ✭ 41 (+46.43%)
Mutual labels:  hapi
Grant
OAuth Proxy
Stars: ✭ 3,509 (+12432.14%)
Mutual labels:  hapi
joi-to-typescript
Convert Joi Schemas to TypeScript interfaces
Stars: ✭ 73 (+160.71%)
Mutual labels:  hapi
Plugo
Dynamically expose modules to hapi plugins
Stars: ✭ 5 (-82.14%)
Mutual labels:  hapi
hapi-sequelizejs
A hapi.js plugin to connect with Sequelize ORM
Stars: ✭ 56 (+100%)
Mutual labels:  hapi
good-influx
InfluxDB broadcasting for Good process monitor
Stars: ✭ 15 (-46.43%)
Mutual labels:  hapi
Openlok
🚈 React.js app to access the Deutsche Bahn API (German Railway Corporation)
Stars: ✭ 15 (-46.43%)
Mutual labels:  hapi
Joi2gql
Conversion of Joi schemas into GraphQL data types
Stars: ✭ 11 (-60.71%)
Mutual labels:  hapi
Joi
The most powerful data validation library for JS
Stars: ✭ 17,989 (+64146.43%)
Mutual labels:  hapi

hapi-boom-decorators

Greenkeeper badge

Known Vulnerabilities js-semistandard-style Circle CI

NPM

A plugin for hapi.js to make responding with Boom errors a little less verbose by decorating the response toolkit with equivilent functions.

This module is tested against Node.js versions 8 and 10. The minimum required version of hapi.js is 17. If you require compatibility with an older version use version 3.0.1 or older.

Install

npm install hapi-boom-decorators --save

Add plugin to hapi server

const hapiBoomDecorators = require('hapi-boom-decorators');

const server = new Hapi.Server();

await server.register(hapiBoomDecorators);

API

The normal way of replying with a Boom error response:

const Boom = require('boom');

server.route({
  method: 'GET',
  path: '/resource/{id}',
  handler: (request, h) => {
    throw Boom.notFound();
  }
});

With hapi-boom-decorators:

server.route({
  method: 'GET',
  path: '/resource/{id}',
  handler: (request, h) => {
    return h.notFound();
  }
})

Check the Boom API documentation for all Boom error types. Every 4xx and 5xxx error, as well as boomify can be called on the response toolkit.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].