From eb9ac1b67a2f2b1b871fa8f745cd010045b026f6 Mon Sep 17 00:00:00 2001 From: Blake Ridgway Date: Sat, 29 Nov 2025 13:31:57 -0600 Subject: [PATCH] fix routes to be /api/ --- cmd/server/main.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/server/main.go b/cmd/server/main.go index aca4ff3..9d4221e 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -89,27 +89,27 @@ func loggingMiddleware(next http.Handler) http.Handler { func setupRoutes(r *chi.Mux) { r.Options("/*", func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Access-Control-Allow-Origin", "*") - w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS") - w.Header().Set("Access-Control-Allow-Headers", "Accept, Authorization, Content-Type") - w.WriteHeader(http.StatusOK) + w.Header().Set("Access-Control-Allow-Origin", "*") + w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS") + w.Header().Set("Access-Control-Allow-Headers", "Accept, Authorization, Content-Type") + w.WriteHeader(http.StatusOK) }) // Public routes r.Get("/health", healthCheck) - // Auth routes + // Auth routes (public - no /api prefix needed for these) authHandler := auth.NewHandler() - r.Post("/signup", authHandler.Signup) - r.Post("/login", authHandler.Login) - r.Post("/logout", authHandler.Logout) - r.Post("/password-reset/request", authHandler.RequestPasswordReset) - r.Post("/password-reset/confirm", authHandler.ConfirmPasswordReset) - r.Post("/refresh-token", authHandler.RefreshToken) + r.Post("/api/signup", authHandler.Signup) + r.Post("/api/login", authHandler.Login) + r.Post("/api/logout", authHandler.Logout) + r.Post("/api/password-reset/request", authHandler.RequestPasswordReset) + r.Post("/api/password-reset/confirm", authHandler.ConfirmPasswordReset) + r.Post("/api/refresh-token", authHandler.RefreshToken) // Protected routes authMiddleware := middleware.NewAuthMiddleware() - r.Route("/protected", func(r chi.Router) { + r.Route("/api/protected", func(r chi.Router) { r.Use(authMiddleware.ProtectedRoute) // User routes