Better routing API #47
Labels
No Label
Kind/Bug
Kind/Enhancement
Kind/Feature
Project/Lander
Project/Landerctl
idea
invalid
question
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Chewing_Bever/lander#47
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. 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
:key
and*keys
, e.g./example/:test
would match/example/hello
and/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.