diff options
Diffstat (limited to 'backend/api/routes.go')
| -rw-r--r-- | backend/api/routes.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/backend/api/routes.go b/backend/api/routes.go new file mode 100644 index 0000000..4dd8660 --- /dev/null +++ b/backend/api/routes.go | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | package api | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "github.com/gin-gonic/gin" | ||
| 5 | "github.com/pektezol/leastportalshub/backend/handlers" | ||
| 6 | swaggerfiles "github.com/swaggo/files" | ||
| 7 | ginSwagger "github.com/swaggo/gin-swagger" | ||
| 8 | ) | ||
| 9 | |||
| 10 | func InitRoutes(router *gin.Engine) { | ||
| 11 | api := router.Group("/api") | ||
| 12 | { | ||
| 13 | v1 := api.Group("/v1") | ||
| 14 | v1.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler)) | ||
| 15 | v1.GET("/", func(c *gin.Context) { | ||
| 16 | c.File("docs/index.html") | ||
| 17 | }) | ||
| 18 | v1.GET("/token", handlers.GetCookie) | ||
| 19 | v1.DELETE("/token", handlers.DeleteCookie) | ||
| 20 | v1.GET("/home", CheckAuth, handlers.Home) | ||
| 21 | v1.GET("/login", handlers.Login) | ||
| 22 | v1.GET("/profile", CheckAuth, handlers.Profile) | ||
| 23 | v1.PUT("/profile", CheckAuth, handlers.UpdateCountryCode) | ||
| 24 | v1.POST("/profile", CheckAuth, handlers.UpdateUser) | ||
| 25 | v1.GET("/users/:id", CheckAuth, handlers.FetchUser) | ||
| 26 | v1.GET("/demos", handlers.DownloadDemoWithID) | ||
| 27 | v1.GET("/maps/:id/summary", handlers.FetchMapSummary) | ||
| 28 | v1.POST("/maps/:id/summary", CheckAuth, handlers.CreateMapSummary) | ||
| 29 | v1.PUT("/maps/:id/summary", CheckAuth, handlers.EditMapSummary) | ||
| 30 | v1.DELETE("/maps/:id/summary", CheckAuth, handlers.DeleteMapSummary) | ||
| 31 | v1.PUT("/maps/:id/image", CheckAuth, handlers.EditMapImage) | ||
| 32 | v1.GET("/maps/:id/leaderboards", handlers.FetchMapLeaderboards) | ||
| 33 | v1.POST("/maps/:id/record", CheckAuth, handlers.CreateRecordWithDemo) | ||
| 34 | v1.GET("/rankings", handlers.Rankings) | ||
| 35 | v1.GET("/search", handlers.SearchWithQuery) | ||
| 36 | v1.GET("/games", handlers.FetchGames) | ||
| 37 | v1.GET("/games/:id", handlers.FetchChapters) | ||
| 38 | v1.GET("/chapters/:id", handlers.FetchChapterMaps) | ||
| 39 | } | ||
| 40 | } | ||