@webstyle/expresshooks
v1.0.1
Published
Express.js hooks
Downloads
3
Readme
Express.js routing lifecycle hooks
Installation
npm i @webstyle/expresshooks --save
before
const { before } = require('expresshooks');
async function logger() {
// your code here....
return true;
}
// Add before hook as middleware
app.get("/", before(logger), function(req, res) {
return res.send("Hello world");
});
after
const { after } = require('expresshooks');
async function logger(response) {
// your code here...
return true;
}
// Add after hook as middleware
app.get("/", before(logger), function(req, res) {
return res.send("Hello world");
});