diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-04 20:49:12 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-04 20:49:12 +0900 |
| commit | ff959dadb1f990173b9df3105ccfc96b1c6c092e (patch) | |
| tree | 4690c2aabafaedb50f86ece4900c9616d9518947 /backend/main.go | |
| parent | fa7755592845a44928e88d2ab78cc04425aa9024 (diff) | |
| parent | f4bae7f755ca25b2547dc98b2db2fdb255948bc5 (diff) | |
| download | iosdc-japan-2024-albatross-ff959dadb1f990173b9df3105ccfc96b1c6c092e.tar.gz iosdc-japan-2024-albatross-ff959dadb1f990173b9df3105ccfc96b1c6c092e.tar.zst iosdc-japan-2024-albatross-ff959dadb1f990173b9df3105ccfc96b1c6c092e.zip | |
Merge branch 'feat/admin-pages'
Diffstat (limited to 'backend/main.go')
| -rw-r--r-- | backend/main.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/backend/main.go b/backend/main.go index 939df03..e2e4bbd 100644 --- a/backend/main.go +++ b/backend/main.go @@ -11,6 +11,7 @@ import ( "github.com/labstack/echo/v4/middleware" oapimiddleware "github.com/oapi-codegen/echo-middleware" + "github.com/nsfisis/iosdc-japan-2024-albatross/backend/admin" "github.com/nsfisis/iosdc-japan-2024-albatross/backend/api" "github.com/nsfisis/iosdc-japan-2024-albatross/backend/db" "github.com/nsfisis/iosdc-japan-2024-albatross/backend/game" @@ -53,6 +54,7 @@ func main() { queries := db.New(connPool) e := echo.New() + e.Renderer = admin.NewRenderer() e.Use(middleware.Logger()) e.Use(middleware.Recover()) @@ -77,6 +79,19 @@ func main() { apiHandler := api.NewHandler(queries, gameHubs) api.RegisterHandlers(apiGroup, api.NewStrictHandler(apiHandler, nil)) + adminHandler := admin.NewAdminHandler(queries, gameHubs) + adminGroup := e.Group("/admin") + adminHandler.RegisterHandlers(adminGroup) + + // For local dev: This is never used in production because the reverse + // proxy sends /login and /logout to the app server. + e.GET("/login", func(c echo.Context) error { + return c.Redirect(http.StatusPermanentRedirect, "http://localhost:5173/login") + }) + e.POST("/logout", func(c echo.Context) error { + return c.Redirect(http.StatusPermanentRedirect, "http://localhost:5173/logout") + }) + gameHubs.Run() if err := e.Start(":80"); err != http.ErrServerClosed { |
