mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 15:48:11 -05:00
Express now removes all trailing slashes.
This commit is contained in:
parent
8a7e7e82a0
commit
3d510b98d6
1 changed files with 6 additions and 0 deletions
|
@ -70,11 +70,17 @@ setupMiddlewareToSendOldBrowserWarningWhenPlayersViewLevelDirectly = (app) ->
|
||||||
return next() if req.query['try-old-browser-anyway'] or not isOldBrowser req
|
return next() if req.query['try-old-browser-anyway'] or not isOldBrowser req
|
||||||
res.sendfile(path.join(__dirname, 'public', 'index_old_browser.html'))
|
res.sendfile(path.join(__dirname, 'public', 'index_old_browser.html'))
|
||||||
|
|
||||||
|
setupTrailingSlashRemovingMiddleware = (app) ->
|
||||||
|
app.use (req, res, next) ->
|
||||||
|
return res.redirect 301, req.url[...-1] if req.url.length > 1 and req.url.slice(-1) is '/'
|
||||||
|
next()
|
||||||
|
|
||||||
exports.setupMiddleware = (app) ->
|
exports.setupMiddleware = (app) ->
|
||||||
setupMiddlewareToSendOldBrowserWarningWhenPlayersViewLevelDirectly app
|
setupMiddlewareToSendOldBrowserWarningWhenPlayersViewLevelDirectly app
|
||||||
setupExpressMiddleware app
|
setupExpressMiddleware app
|
||||||
setupPassportMiddleware app
|
setupPassportMiddleware app
|
||||||
setupOneSecondDelayMiddleware app
|
setupOneSecondDelayMiddleware app
|
||||||
|
setupTrailingSlashRemovingMiddleware app
|
||||||
|
|
||||||
###Routing function implementations###
|
###Routing function implementations###
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue