Socket
Book a DemoInstallSign in
Socket

exhooks

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exhooks

yet another express middleware.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

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

Keywords

hooks

FAQs

Package last updated on 10 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts