I'm try to use express to build a simple website. everything it's works fine, until I decide to add a below code to catch 404 error
app.get('/*', function(req, res) {
res.render('404.ejs',{
title: 'PAGE NOT FOUND',
layout:'layout'})
});
after that, notice all internal CSS file and JavaScript recourse file, not able to load correctly, I figure out because those CSS and JavaScript file ref link it's not inside the routing configure. That why all route to page not found which catch by /*
so just want to know, what is correct way, I can catch the 404 errors and display my own customize page, and also no impact on all resource file loading. Thanks!