25 lines
571 B
Go
25 lines
571 B
Go
// Path: Backend/internal/router/router.go
|
|
|
|
package router
|
|
|
|
import (
|
|
"boostai-backend/internal/config"
|
|
"boostai-backend/internal/database"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
func Setup(app *fiber.App, cfg *config.Config, db *database.DB) {
|
|
authMiddleware := buildAuthMiddleware(cfg)
|
|
|
|
registerWebRoutes(app, cfg, db, authMiddleware)
|
|
registerAPIRoutes(app, cfg, db, authMiddleware)
|
|
|
|
app.Use(func(c *fiber.Ctx) error {
|
|
return c.Status(fiber.StatusNotFound).JSON(fiber.Map{
|
|
"error": "not_found",
|
|
"message": "The requested endpoint does not exist",
|
|
})
|
|
})
|
|
}
|