-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Milestone
Description
Feature Description
I was thinking it'd be awesome if the buildTree method in App could be made public. This tweak would open up possibilities for dynamic request handling.
already checked #735 I get that rebuilding the tree might be resource-intensive, but we'd only use it during development. This way, we can ensure our routing behaves as expected without resorting to an * route and redoing all the routing and parsing logic.
Our goal is to enable users to define routes dynamically, with handlers loaded in on-the-fly. So, by simply making the buildTree method public, it'd really help us out.
Additional Context (optional)
The code snippet below illustrates how making buildTree public could streamline fiber routing without the need for using *.
s.app.Get("/define", func(ctx *fiber.Ctx) error {
// load config
path := "/test/:param"
s.app.Get(path, func(ctx *fiber.Ctx) error {
// load the handler instruction
// executing logic written by user
// can access the :param easily
return nil
})
// after each definition
s.app.BuildTree()
return ctx.JSON(map[string]any{
"success": true,
})
})Code Snippet (optional)
No response
Checklist:
- I agree to follow Fiber's Code of Conduct.
- I have checked for existing issues that describe my suggestion prior to opening this one.
- I understand that improperly formatted feature requests may be closed without explanation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Projects
Status
Done