From d962eb530445579281b2da2de01c821a0571d92e Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 12 Feb 2024 00:01:22 -0500 Subject: [PATCH] refactor: put api under both /api and /api/v3 --- api/routes_rest_api.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/routes_rest_api.go b/api/routes_rest_api.go index dc2ed05..305dc15 100644 --- a/api/routes_rest_api.go +++ b/api/routes_rest_api.go @@ -142,9 +142,15 @@ func setupRestRoutes(params RouteParams) { r := params.R restApi := newRestApi(cfg, logger) + + setupRoutes := func(r *mux.Router) { + r.HandleFunc("/repos/{owner}/{repo}/pulls/{pull_number}/files", restApi.handlerGetPullRequestFiles).Methods("GET") + } + restRouter := r.PathPrefix("/api").Subrouter() restRouter.Use(githubRestVerifyMiddleware(params.Db)) restRouter.Use(githubRestRequireAuthMiddleware(params.Config)) - restRouter.HandleFunc("/repos/{owner}/{repo}/pulls/{pull_number}/files", restApi.handlerGetPullRequestFiles).Methods("GET") + setupRoutes(restRouter) + setupRoutes(restRouter.PathPrefix("/v3").Subrouter()) }