Skip to content

Commit e80e304

Browse files
committed
🔧 [main] group router with gin group
1 parent cdb11b2 commit e80e304

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

router/router.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ func InitRoutes() *gin.Engine {
2121
router.Use(cors.New(config))
2222

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

2728
// Handling route not existing problem
2829
router.NoRoute(controller.MissingRouteHandler)

0 commit comments

Comments
 (0)