-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📝 [Proposal]: Allow removing registered route #3098
Comments
@rebaz94 Rebuilding the tree by itself is not thread-safe already, adding this functionality would make it even worse. |
Hi @gaby, of course but it's important to note that production applications typically don't define routes at runtime. This approach is safe during development when you're iterating on your application. In my case I'm building a no-code solution where I need to add, update or remove routes while the server is running during development but for the production environment, I will generate the routes statically. |
@rebaz94 The trade-off is huge. We ran benchmarks and it requires adding a Mutex in several parts which would make Fiber way slower across the board. Especially when calling |
Sure. but I don't think adding |
@ReneWerner87, is there any chance this feature could be included in v3? |
@rebaz94 From me, I'd say yes, but we may need to add a "Development" page to the docs 😂 |
This probably needs to be analyzed thoroughly, and also it's good to notice that the |
Hi, I would like to work on this one. |
@ckoch786 Assigned |
Feature Proposal Description
Following the addition of
RebuildTree
method #2769, which enabled dynamic request handling, I propose enhancing this functionality by allowing the removal of registered routes.Currently, while we can dynamically add routes, the ability to remove them is limited. When adding a route with the same path, instead of updating the existing handler, a new one is added, which prevents the updated handler from being invoked. To address this issue, and to provide a way to remove routes that are no longer needed, we require a method to completely remove the route.
Alignment with Express API
N/A
HTTP RFC Standards Compliance
N/A
API Stability
The proposed feature will involve the addition of a single method,
RemoveRoute
, which will be used to unregister specific routes based on the path and HTTP methods. This function will maintain the stability of the API by ensuring that the removal process is straightforward and does not interfere with other routes or the overall routing structure.Feature Examples
Checklist:
The text was updated successfully, but these errors were encountered: