npm i @webstyle/expresshooks --save
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");
});
const { after } = require('expresshooks');
async function logger(response) {
// your code here...
return true;
}
// Add after hook as middleware
app.get("/", after(logger), function(req, res) {
return res.send("Hello world");
});