소스 검색

Add custom redirect for /docs

We want to redirect POST and GET to different locations, but this is
unsupported by RedirectManager. Therefore we redirect GETs with
RedirectManager and POSTs with this custom route.
Alasdair Smith 8 년 전
부모
커밋
9c0a888d11
1개의 변경된 파일과 6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      services/web/app/coffee/router.coffee

+ 6 - 0
services/web/app/coffee/router.coffee

@@ -330,6 +330,12 @@ module.exports = class Router
 			AuthenticationController.httpAuth,
 			AuthenticationController.httpAuth,
 			CompileController.getFileFromClsiWithoutUser
 			CompileController.getFileFromClsiWithoutUser
 
 
+		# We want to redirect POST and GET to different locations, but this is
+		# unsupported by RedirectManager. Therefore we redirect GETs with
+		# RedirectManager and POSTs with this custom route
+		publicApiRouter.post '/docs', (req, res, next) ->
+			res.redirect(307, "#{Settings.apis.v1.url}/docs")
+
 		webRouter.get '/teams', (req, res, next) ->
 		webRouter.get '/teams', (req, res, next) ->
 			# Match v1 behaviour - if the user is signed in, show their teams list
 			# Match v1 behaviour - if the user is signed in, show their teams list
 			# Otherwise show some information about teams
 			# Otherwise show some information about teams