feat: Add API key middleware and update configuration to support API key validation
This commit is contained in:
@@ -4,11 +4,14 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/timetracker/backend/internal/api/handlers"
|
||||
"github.com/timetracker/backend/internal/api/middleware"
|
||||
"github.com/timetracker/backend/internal/config"
|
||||
)
|
||||
|
||||
// SetupRouter configures all the routes for the API
|
||||
func SetupRouter(r *gin.Engine) {
|
||||
func SetupRouter(r *gin.Engine, cfg *config.Config) {
|
||||
// Create handlers
|
||||
// Apply API key middleware to all API routes
|
||||
r.Use(middleware.APIKeyMiddleware(cfg))
|
||||
userHandler := handlers.NewUserHandler()
|
||||
activityHandler := handlers.NewActivityHandler()
|
||||
companyHandler := handlers.NewCompanyHandler()
|
||||
|
||||
Reference in New Issue
Block a user