establishing initial auth middleware and routes
This commit is contained in:
parent
f251f52fa9
commit
5c5ba78a32
6 changed files with 92 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ import (
|
|||
func SetupRoutes(a *app.App) http.Handler {
|
||||
auth := handler.NewAuthHandler()
|
||||
home := handler.NewHomeHandler()
|
||||
dashboard := handler.NewDashboardHandler()
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
|
|
@ -28,6 +29,12 @@ func SetupRoutes(a *app.App) http.Handler {
|
|||
mux.HandleFunc("GET /auth", middleware.RequireGuest(auth.AuthPage))
|
||||
mux.HandleFunc("GET /auth/password", middleware.RequireGuest(auth.PasswordPage))
|
||||
|
||||
// ====================================================================================
|
||||
// PRIVATE ROUTES
|
||||
// ====================================================================================
|
||||
|
||||
mux.HandleFunc("GET /app/dashboard", middleware.RequireAuth(dashboard.DashboardPage))
|
||||
|
||||
// 404
|
||||
mux.HandleFunc("/{path...}", home.NotFoundPage)
|
||||
|
||||
|
|
@ -37,6 +44,7 @@ func SetupRoutes(a *app.App) http.Handler {
|
|||
middleware.Config(a.Cfg),
|
||||
middleware.RequestLogging,
|
||||
middleware.CSRFProtection,
|
||||
middleware.AuthMiddleware(a.AuthService, a.UserService),
|
||||
middleware.WithURLPath,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue