node.js - NodeJS and Express interceptors -
i'm trying code interceptor metrologie purpose. interceptor must called before http query (and before express job) put time informations , after express's job duration of call.
i'm trying middleware , it's working fine "before" call not "after" call cause when route found, propagation through other middleware stopped.
please provide clues interceptors working in cases.
edit :
what i'm trying have sort of aop javascript in fact...
the 'before' interceptor middleware :
// jmc add metrologie informations route called app.use(function (req, res, next) { var name = req.originalmethod + req.originalurl; log.trace('start metroinfo route : %s', name); metro.startmetrologie(name); return next(); });
thank's in advance.
if need intercept response consider middleware express-interceptor it's quite easy use , enable respond requests usual.
Comments
Post a Comment