code refactor, added middleware,
This commit is contained in:
21
router/router.go
Normal file
21
router/router.go
Normal 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)
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user