@flexshopper/hapi-listeners
v1.0.1
Published
Standard NPM package with Flexshopper coding standards and guidelines.
Downloads
1
Keywords
Readme
@flexshopper/hapi-listeners
Documentation
Getting started
How use it
- Install
hapi-listeners
npm package in your project our plugin.npm i @flexshopper/hapi-listeners
Registering
manifest style:
registrations: [
...
{
plugin: {
register: '@flexshopper/hapi-listeners',
options: {
dirname: '/lib/listeners'
}
}
}
];
Listener structure:
module.exports = {
name: 'eventName',
method: (data) => {
// any code that will execute when eventName is fired
}
};
Just by creating a kraken event in any route handler
server.route({
method: 'GET',
path: '/route',
handler: (request, reply) => {
request.krakenEvent = {
name: 'eventName',
data: {}
};
}
})