The correct answer is using the res.on("finish", cb) callback.
i.e.:
express.use(function(req, res, next) {
console.log("before");
res.on("finish", function() {
console.log("after");
});
next();
});
The correct answer is using the res.on("finish", cb) callback.
i.e.:
express.use(function(req, res, next) {
console.log("before");
res.on("finish", function() {
console.log("after");
});
next();
});