aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/admin/handlers.go2
-rw-r--r--backend/admin/templates/dashboard.html3
-rw-r--r--backend/main.go7
3 files changed, 11 insertions, 1 deletions
diff --git a/backend/admin/handlers.go b/backend/admin/handlers.go
index 1c7995d..f81856c 100644
--- a/backend/admin/handlers.go
+++ b/backend/admin/handlers.go
@@ -236,5 +236,5 @@ func (h *AdminHandler) postGameEdit(c echo.Context) error {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
- return c.String(http.StatusNoContent, "")
+ return c.NoContent(http.StatusNoContent)
}
diff --git a/backend/admin/templates/dashboard.html b/backend/admin/templates/dashboard.html
index 2d7e8ad..cdb8ba1 100644
--- a/backend/admin/templates/dashboard.html
+++ b/backend/admin/templates/dashboard.html
@@ -7,4 +7,7 @@
<p>
<a href="/admin/games">Games</a>
</p>
+<form method="post" action="/logout">
+ <button type="submit">Logout</button>
+</form>
{{ end }}
diff --git a/backend/main.go b/backend/main.go
index 7330109..2d38ee5 100644
--- a/backend/main.go
+++ b/backend/main.go
@@ -83,6 +83,13 @@ func main() {
adminGroup := e.Group("/admin")
adminHandler.RegisterHandlers(adminGroup)
+ // For local dev:
+ // This is never used in production because the reverse proxy sends /logout
+ // to the app server.
+ 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 {