exhooks

1.0.1 • Public • Published

ExHooks Build Status Coverage Status Dependency Status License: MIT npm npm version NPM

lightweight nodejs library that allows you to register whichever hook you want, and you can issue it whenever you want, as easy as say hello.

Install.

  • npm install --save exhooks
  • npm install exhooks
  • yarn add exhooks

Usage.

var exhooks = require('exhooks');
var express = require('express');
var app = express();
 
var hook_events = [
    {
    eventName: 'logout',
    eventFunc: (param) => { console.log('bye bye =) ' + param) }
    }
]
 
app.use(exhooks(hook_events));
app.get('/logout', (req, res) => {
 
        .
        .
        .
 
    req.hooks.logout(1);
    res.status(200).json({
        message: "ok"
    })
});
 
app.listen(3000);

What you cannot do.

  • You cannot register hooks that contains any number
  • You cannot register hooks that contains any special character.
  • You cannot register hooks that are duplicated.

License.

License MIT

Changelogs

Changelogs

Authors

Leonardo Javier Esparis Meza

/exhooks/

    Package Sidebar

    Install

    npm i exhooks

    Weekly Downloads

    3

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • leoxnidas