40 lines
1.2 KiB
Go
40 lines
1.2 KiB
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/demo"
|
|
"app/handlers/execution"
|
|
"app/handlers/incident"
|
|
"app/handlers/proposal"
|
|
"app/handlers/report"
|
|
"app/handlers/welcome"
|
|
appmiddleware "app/middleware"
|
|
)
|
|
|
|
func Web(route *routing.Router, cfg *config.Config) {
|
|
route.Get("/", welcome.Show)
|
|
route.Get("/demo", demo.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)
|
|
operator.Post("/incidents/{scope}/{target}/proposals", proposal.Store)
|
|
operator.Get("/proposals/{proposal}", proposal.Show)
|
|
operator.Post("/proposals/{proposal}/approval", proposal.Approve)
|
|
operator.Get("/executions/{execution}", execution.Show)
|
|
operator.Get("/reports/{report}", report.Show)
|
|
|
|
route.Fallback(func(*web.Request) *web.Response {
|
|
return web.Abort(http.StatusNotFound)
|
|
})
|
|
}
|