I'm stuck in trying to get error pages rendered with a template in my expressJs app. While I try to write..
app.get('/*', pages.error_page);
..the app works fine but without any style! Removing that line everything comes back to normal. Here's my simple function to load error page:
exports.errore_pagina = function (req, res){
res.render('errore', {title: 'Pagina errore'});
}
The app.get is in the bottom of the page just before:
http.createServer(app).listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port'));
});
Did anybody find the same issue? Thanks a lot! Francesco
I already had a line for handling static files:
app.use(express.static(path.join(__dirname, 'public')));
The issue was about the position! As suggested by @rdrey that line should be before the app.router! Thanks to @HectorCorrea too!