I'd like to create some Express middleware that injects content into the <head> part of every HTML document returned by the server. Is this possible or advisable?
Thanks!
Example:
app.all("*", function(req,res,next){
res.set({
"Myheader1":"Data1",
"MyHeader2":"Data2"
});
next();
});
You should be using a templating engine like JADE, it allows layouts, you can define basic inheritance. I advise you to look at Template inheritance from Jade documentation. I bet most templating languages have this functionality.