Grouping
If you have many endpoints, you can organize your routes using Group
- func main() {
- app := fiber.New()
- api := app.Group("/api", cors()) // /api
- v1 := api.Group("/v1", mysql()) // /api/v1
- v1.Get("/list", handler) // /api/v1/list
- v1.Get("/user", handler) // /api/v1/user
- v2 := api.Group("/v2", mongodb()) // /api/v2
- v2.Get("/list", handler) // /api/v2/list
- v2.Get("/user", handler) // /api/v2/user
- app.Listen(3000)
- }