Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Handle not found routes #51

Closed
panosru opened this Issue Feb 17, 2012 · 5 comments

Comments

Projects
None yet
2 participants

panosru commented Feb 17, 2012

I used to set app.all('/*', function (req, res, next) ... as my last route in order to handle routes that are not found, it used to work fine but now that I use express-resource it seems that static content like .css, .js, .jpg are processed by the router without express-resource they are not processed and app.all('/*'... handles not found routes properly

panosru commented Feb 17, 2012

I see this is related to #38

Owner

tj commented Feb 17, 2012

ideally they are whitelisted since there's an infinite possibility of extensions really. However it's easy to a) add express.static() above app.router, or add app.use(function(req, res, next){ my 404 stuff here }) below app.router and all the other middleware

panosru commented Feb 17, 2012

@visionmedia this is what I have now and is not working for me... if you check my application index you will see that I call App.static() before the router and the handler after the router...

Owner

tj commented Feb 17, 2012

add a function after ErrorHandler.handle, if connect is responding with "Cannot GET /whatever" etc you can respond in that function

panosru commented Feb 17, 2012

@visionmedia ok I used it in another way, some-how like you proposed with a fn after ErrorHandler.handle method. :)

@panosru panosru closed this Feb 17, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment