Added auth routes with jwt generation and middleware.

This commit is contained in:
2026-04-25 19:38:31 +02:00
parent 8ec981c860
commit 371784af77
5 changed files with 190 additions and 10 deletions
+12 -2
View File
@@ -18,11 +18,21 @@ func (s *Server) setupRoutes() *chi.Mux {
// Public routes
router.Group(func(r chi.Router) {
// Auth Routes
router.Post("/register", s.handleRegister())
router.Post("/login", s.handleLogin())
router.Post("/logout", s.handleLogout())
// public pages
r.Get("/", s.handleHome())
})
//s.router.Get("/", s.handleIndex())
//s.router.Post("/users", s.handleCreateUser())
// User routes
router.Group(func(r chi.Router) {
// Requires log in
r.Use(s.hasAuth)
router.Mount("/users", s.userRoutes())
})
return router
}