1.0.1 • Published 8 years ago

@flexshopper/hapi-listeners v1.0.1

Weekly downloads
1
License
-
Repository
github
Last release
8 years ago

@flexshopper/hapi-listeners NPM version Build Status

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: {}
        };
    }
})

Guidelines

License

© Flexshopper, LLC

1.0.1

8 years ago

1.0.0

8 years ago