I want to minify the HTML on the views, so I need to inject a function (middleware) that gets the request content and parse to minify the html / ejs.
I was trying this: http://stackoverflow.com/questions/25667227/how-to-sailsjs-minify-html-views-with-ejs
But it was closed, I don't know why, now I'm trying this code below, but the console doesn't show the logs, so the events are not being called. Anyone knows how to do this?
module.exports = {
http: {
customMiddleware: function (app) {
app.use(function(req,res, next) {
res.on('data', function(chunk){
console.log("INFO: "+chunk);
response += chunk;
});
res.on('end', function(){
console.log("End received!");
});
res.on('close', function(){
console.log("Close received!");
});
next();
});
}
}
};