my-homelab-configs/apps/opsproof/overlay/routes/web.go

30 lines
789 B
Go

package routes
import (
"net/http"
"go.laravel.com/auth"
"go.laravel.com/config"
"go.laravel.com/routing"
"go.laravel.com/web"
"app/handlers/authentication"
"app/handlers/incident"
"app/handlers/welcome"
appmiddleware "app/middleware"
)
func Web(route *routing.Router, cfg *config.Config) {
route.Get("/", welcome.Show)
route.Get("/login", authentication.Login).Name("login")
route.Get("/auth/dex/callback", authentication.Callback)
route.Post("/logout", authentication.Logout).Middleware(auth.Authenticate{}, appmiddleware.Operator{})
operator := route.Middleware(auth.Authenticate{}, appmiddleware.Operator{})
operator.Get("/incidents/{scope}/{target}", incident.Show)
route.Fallback(func(*web.Request) *web.Response {
return web.Abort(http.StatusNotFound)
})
}