Created
March 4, 2013 01:14
-
-
Save Sinetheta/5079257 to your computer and use it in GitHub Desktop.
NodeJS connect middleware for removing trailing slashes http://stackoverflow.com/a/13443359/848249
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.use(function(req, res, next) { | |
if(req.url.substr(-1) == '/' && req.url.length > 1) | |
req.url.slice(0, -1); | |
next(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment