https://github.com/fritzy/drboom-gatepost
Catch gatepost errors and turn them into hapi Boom errors.
https://github.com/fritzy/drboom-gatepost
Last synced: 7 months ago
JSON representation
Catch gatepost errors and turn them into hapi Boom errors.
- Host: GitHub
- URL: https://github.com/fritzy/drboom-gatepost
- Owner: fritzy
- License: mit
- Created: 2016-02-13T08:26:27.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-13T09:06:36.000Z (over 9 years ago)
- Last Synced: 2025-01-25T21:55:25.644Z (8 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dr. Boom: Gatepost

Auto-cast errors from [Gatepost](https://github.com/fritzy/gatepost) into Hapi HTTP Errors.
##Example / Boilerplate
Plugin registration boilerplate:
```javascript
var hapi = require('hapi');
var config = require('./config.json');
var Boom = require('boom');
var Gatepost = require('gatepost')(config.db);var server = new hapi.Server();
server.connection(config);server.register([{
register: require('drboom'),
options: {
plugins: [require('drboom-gatpost')({Gatepost: Gatepost, Boom: Boom})]
},
}, function (err) {
server.log(['startup'], 'Loaded pgboom plugin');
server.start(function (err) {
//...
}
});
```Now, you can pass your seaquell errors right on through to hapi reply!
```javascript
function someHandler(request, reply) {
SomeGatepostModel.method(reply);
});
```