Protecting our routes with auth middleware

This commit is contained in:
2024-07-22 10:13:50 +02:00
parent 68d9110cd2
commit dedab91898
3 changed files with 29 additions and 1 deletions

View File

@ -37,5 +37,10 @@ func routes(app *config.AppConfig) http.Handler {
fileServer := http.FileServer(http.Dir("./static/"))
mux.Handle("/static/*", http.StripPrefix("/static", fileServer))
mux.Route("/admin", func(mux chi.Router) {
mux.Use(Auth)
mux.Get("/dashboard", handlers.Repo.AdminDashboard)
})
return mux
}