Skip to content

Commit

Permalink
🔧 [main] group router with gin group
Browse files Browse the repository at this point in the history
  • Loading branch information
DenChenn committed Apr 1, 2022
1 parent cdb11b2 commit e80e304
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ func InitRoutes() *gin.Engine {
router.Use(cors.New(config))

// Define routing path
router.GET("/"+constants.CURRENT_VERSION+"/:url_id/", middleware.Cache(), controller.GetUrlHandler)
router.POST("/"+constants.CURRENT_VERSION+"/urls/", controller.CreateUrlHandler)
versionRouter := router.Group("/" + constants.CURRENT_VERSION)
versionRouter.GET("/:url_id/", middleware.Cache(), controller.GetUrlHandler)
versionRouter.POST("/urls/", controller.CreateUrlHandler)

// Handling route not existing problem
router.NoRoute(controller.MissingRouteHandler)
Expand Down

0 comments on commit e80e304

Please sign in to comment.