Skip to content

webstyle/express-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

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("/", after(logger), function(req, res) {
  return res.send("Hello world");
});

About

Express.js routing lifecycle hooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published