Skip to content

Commit

Permalink
Merge pull request #37 from fy23-gw-gackathon/fix/#36_router_basepath
Browse files Browse the repository at this point in the history
ref #36 fix endpoint prefix
  • Loading branch information
gari8 committed May 17, 2023
2 parents 7460adb + eb7f65c commit 91cfff4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ func main() {
app.GET("/", func(ctx *gin.Context) {
ctx.String(http.StatusOK, "It works")
})
app.GET("/users/me", handleResponse(userController.GetMe))
app.PUT("/reports/:reportId", handleResponse(reportController.ReviewReport, http.StatusNoContent))
orgs := app.Group("/organizations")
api := app.Group("/api/v1")
api.GET("/users/me", handleResponse(userController.GetMe))
api.PUT("/reports/:reportId", handleResponse(reportController.ReviewReport, http.StatusNoContent))
orgs := api.Group("/organizations")
orgs.Use(middleware.Authentication(userPersistence, cfg))
{
orgs.GET("/", handleResponse(organizationController.GetOrganizations))
Expand All @@ -75,7 +76,7 @@ func runApp(app *gin.Engine, port int) {
docs.SwaggerInfo.Description = "Reportify"
docs.SwaggerInfo.Version = "1.0"
docs.SwaggerInfo.Host = fmt.Sprintf("localhost:%d", port)
docs.SwaggerInfo.BasePath = "/"
docs.SwaggerInfo.BasePath = "/api/v1"
docs.SwaggerInfo.Schemes = []string{"http"}
app.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
log.Println(fmt.Sprintf("http://localhost:%d", port))
Expand Down
2 changes: 1 addition & 1 deletion worker/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (h handler) CommentReport(payload string) error {
return err
}

if _, err = h.Http.Put(fmt.Sprintf("http://backend:8080/reports/%s", m.ID), d); err != nil {
if _, err = h.Http.Put(fmt.Sprintf("http://backend:8080/api/v1/reports/%s", m.ID), d); err != nil {
return err
}
return nil
Expand Down

0 comments on commit 91cfff4

Please sign in to comment.