pauljz gave a basic method, but to extend it, here is an example of middleware
module.exports = function() { return function(req, res, next) { req.on("end", function() {
In the main application
expressApp.use(require("./doneMiddleware")); expressApp.use(express.logger()); expressApp.use(express.static.....
Morgan ARR Allen
source share