express-ctx
express
context based on async_hooks
without getting lost context
Install
npm i express-ctx
Usage
const express = ;const middleware setValue getValue = ;const usersRepository = ; // some your services const app = ; app; // must be set before using setValue/getValue app; app;
Other libs
As for now such libraries as express-http-context
and express-cls-hooked
do not bind req
and res
to namespace, so there could be troubles with middlewares based on emitting events. So this lib binds.