404.html file not being served#181
Conversation
|
I know this is quite basic, but couldn't you just use the |
|
@JaKXz the use case I have is that express serves more than just the Angular app - perhaps a static information site, or other 'simple' pages that don't need Angular. In this case, routing to these other static pages is important - this covers the 404 page too. |
|
👍 I like to automatically generate a styleguide from the css using grunt-kss so this will be useful |
|
This issue is present in v2.x, any ideas for the correct solution? |
|
Not sure exactly what the issue is here. All the html files located in the views folders are intended to be rendered with EJS, so to render one of the views you would add a route to your express routes: app.route('/example').get(function(req, res) {
res.render('example');
}); |
|
@DaftMonk I apologize for my delayed reply, but with v2.0.8, I can hit any URL and if the route is not registered in my app it will just go to |
|
Well for that problem we need to do handling of 404s on the client side. Instead of redirecting to |
Currently the
404.htmlfile in theapp/viewsfolder can't be served as express is sendingindex.htmlfor any request that isn't an API call or a partial.This PR uses the same methodology as for the partials - i.e. first express tries to render a file by the passed name, otherwise falling back to
index.html. This way, custom error pages and any other static / server-side pages can be added to theapp/viewsfolder and served as normal.