hapi-pres
v1.0.0
Published
Autoload pre-requirements for HapiJS.
Downloads
5
Readme
hapi-pres
Plugin to autoload pre-requirements.
How to use:
- Install
hapi-pres
npm package in your project our plugin.npm i hapi-pres
- Register plugin in your hapi server:
Registering
const server = new Hapi.Server();
server.connection();
server.register({
register: require('hapi-pres'),
options: {
dirname: 'path/to/pres' // required
}
}, (err) => {
// continue application
});
manifest style:
registrations: [
...
{
plugin: {
register: 'hapi-pres',
options: {
dirname: 'path/to/pres'
}
}
}
];
Your pre-requirements are available in your server
object.
server.pre.preFilename.preObjectKey
Pre-requirement Signature
'use strict';
exports.preA = {
assign: 'preA',
method: (request, reply) => {
return reply({
message: 'Hello World.'
});
};
};