start setting up auth handler

This commit is contained in:
juancwu 2025-12-15 21:50:54 -05:00
commit 979a415b95
4 changed files with 62 additions and 0 deletions

View file

@ -6,14 +6,21 @@ import (
"git.juancwu.dev/juancwu/budgething/assets"
"git.juancwu.dev/juancwu/budgething/internal/app"
"git.juancwu.dev/juancwu/budgething/internal/handler"
"git.juancwu.dev/juancwu/budgething/internal/middleware"
)
func SetupRoutes(a *app.App) http.Handler {
auth := handler.NewAuthHandler()
mux := http.NewServeMux()
// Static
sub, _ := fs.Sub(assets.AssetsFS, ".")
mux.Handle("GET /assets/", http.StripPrefix("/assets/", http.FileServer(http.FS(sub))))
// Auth pages
mux.HandleFunc("GET /auth", middleware.RequireGuest(auth.AuthPage))
return mux
}