code refactor, added middleware,

This commit is contained in:
2025-01-28 15:26:22 +01:00
parent 52aa874f8f
commit f7efee56f0
10 changed files with 133 additions and 66 deletions

21
router/router.go Normal file
View File

@@ -0,0 +1,21 @@
package router
import (
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/logger"
"relay-server/handlers"
"relay-server/middleware"
)
func SetupRoutes(app *fiber.App) {
app.Get("/", middleware.Protected(), func(c *fiber.Ctx) error {
return c.SendString("Hello, World!")
})
api := app.Group("/api", logger.New())
// Auth group
auth := api.Group("/auth")
auth.Post("/signup", handlers.Signup)
auth.Post("/login", handlers.Login)
}