routes: group certain endpoints
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2023-08-13 15:52:31 +02:00
parent afcd7c4198
commit 1b64571429
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI

@ -45,16 +45,18 @@ func (a *App) SetupRoutes() error {
e.GET("/assets/*", echo.WrapHandler(http.StripPrefix("/assets/", assets)), handlers.MiddlewareCache, compress)
e.HEAD("/assets/*", echo.WrapHandler(http.StripPrefix("/assets/", assets)), handlers.MiddlewareCache, compress)
e.GET("/healthz", handlers.Healthz())
e.GET("/health", handlers.Healthz())
base := e.Group("/")
e.GET("/", handlers.Index(), compress)
e.HEAD("/", handlers.Index(), compress)
e.GET("/signin", handlers.Signin(), compress)
e.POST("/signin", handlers.SigninPost(a.db))
e.GET("/signup", handlers.Signup(), compress)
e.POST("/signup", handlers.SignupPost(a.db))
e.GET("/home", handlers.Home(a.db), compress)
base.GET("/healthz", handlers.Healthz())
base.GET("/health", handlers.Healthz())
base.GET("/", handlers.Index(), compress)
base.HEAD("/", handlers.Index(), compress)
base.GET("/signin", handlers.Signin(), compress)
base.POST("/signin", handlers.SigninPost(a.db))
base.GET("/signup", handlers.Signup(), compress)
base.POST("/signup", handlers.SignupPost(a.db))
base.GET("/home", handlers.Home(a.db), compress)
// handle weird attempts here.
e.POST("/signin/*", func(c echo.Context) error {
@ -64,15 +66,17 @@ func (a *App) SetupRoutes() error {
return c.NoContent(http.StatusNotFound)
})
e.GET("/manage/api-keys", handlers.ManageAPIKeys(), handlers.MiddlewareSession)
e.GET("/manage/users", handlers.ManageUsers(), handlers.MiddlewareSession)
e.GET("/manage/users/new", handlers.ManageUsers(), handlers.MiddlewareSession)
e.POST("/manage/users/create", handlers.CreateUser(), handlers.MiddlewareSession)
e.GET("/manage/users/:id", handlers.ViewUser(), handlers.MiddlewareSession)
e.GET("/manage/users/:id/edit", handlers.EditUser(), handlers.MiddlewareSession, handlers.MiddlewareCache, compress)
e.GET("/manage/users/:id/delete", handlers.DeleteUserConfirmation(), handlers.MiddlewareSession)
e.POST("/manage/users/:id/update", handlers.UpdateUser(), handlers.MiddlewareSession)
e.POST("/manage/users/:id/delete", handlers.DeleteUser(), handlers.MiddlewareSession)
admin := e.Group("/manage", handlers.MiddlewareSession)
admin.GET("/manage/api-keys", handlers.ManageAPIKeys())
admin.GET("/manage/users", handlers.ManageUsers())
admin.GET("/manage/users/new", handlers.ManageUsers())
admin.POST("/manage/users/create", handlers.CreateUser())
admin.GET("/manage/users/:id", handlers.ViewUser())
admin.GET("/manage/users/:id/edit", handlers.EditUser(), handlers.MiddlewareCache, compress)
admin.GET("/manage/users/:id/delete", handlers.DeleteUserConfirmation())
admin.POST("/manage/users/:id/update", handlers.UpdateUser())
admin.POST("/manage/users/:id/delete", handlers.DeleteUser())
e.GET("/logout", handlers.Logout(), compress)
e.POST("/logout", handlers.Logout(), handlers.MiddlewareSession)