Better routing API #47
Labels
No labels
Kind/Bug
Kind/Enhancement
Kind/Feature
Project/Lander
Project/Landerctl
idea
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Chewing_Bever/lander#47
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The API for defining routes is still a bit lacking right now in my opinion.
I'd like to add the concept of a router, a group of routes that can be mounted together at a specific subpath. Each of these routers can have the concept of "global steps", namely steps that get executed before a route's specific steps. This could be used to automatically add rate limiting or authentication to multiple routes at once. Routers should be able to get nested; this way the global router could be exposed as the API for adding all other routers. Of course we should account for routing conflicts.
These routers can then be added to the HTTP loop, where they will be merged into one large routing scheme (I don't think there's a need to keep this abstraction inside the loop, it's just for ease of use for the user).
The routing code itself is also not optimal; I'd like to switch from RegEx and going over a list of elements to a trie-based approach that supports
:keyand*keys, e.g./example/:testwould match/example/helloand/example/world, with these variables being exposed to the user by name using some API.This got implemented for the most part after I migrated LNM to a different repository.