refactor: put api under both /api and /api/v3

This commit is contained in:
Derrick Hammer 2024-02-12 00:01:22 -05:00
parent 41532495bc
commit d962eb5304
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 7 additions and 1 deletions

View File

@ -142,9 +142,15 @@ func setupRestRoutes(params RouteParams) {
r := params.R r := params.R
restApi := newRestApi(cfg, logger) 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 := r.PathPrefix("/api").Subrouter()
restRouter.Use(githubRestVerifyMiddleware(params.Db)) restRouter.Use(githubRestVerifyMiddleware(params.Db))
restRouter.Use(githubRestRequireAuthMiddleware(params.Config)) 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())
} }