fn
fn copied to clipboard
An easier way to determine what handler will handle some request
In my codebase, we have many routes. One thing that I like about Fn is that I can put routes where ever it makes sense it me -- to compare to Rails, it's not all stuck in routes.rb
.
So we have a main routing function routes
in Site
that says that all routes starting with "/admin" are routed through adminRoutes
in Handle.Admin
. Other routes are handled by userRoutes
or apiRoutes
or other routing functions, and not all of them have as straightforward signals as "starts with foo".
People who are new to the codebase find it confusing that they can't immediately find a handler by looking at the main routing function, and sometimes you have to go two or more functions deep to finally find the handler for a given request!
I think it would be neat if there was a tool of some sort (like Rails' rake routes
) to see all the routes and handlers at once, or to construct a simple version of a request and ask "what would handle this?".
Would probably require some static analysis?