Good Morning!
mogge
Morning
👋 Thursday last week was my last day of work for the year - nice to have a relaxing finish to the year.
morning
månmån
morning
FWIW i prefer routes defined as functions that take maps
i like being able to execute them in the repl
i like being able to unit test them like regular fns
Oh, you're all talking about handlers, not routers.
how does every route as a function work @jiriknesl? do they get called in sequence until one says yes ?
Is it common, if you have a map and a value to a key is a function, to name the key something like foo-bar-fn
?
{:foo-bar-fn (fn [x y] (+ x y))}
for example
or simply
{:foo-bar (fn [x y] (+ x y))}
@dharrigan I lean toward -fn
(and you'll see that in next.jdbc
and elsewhere in my OSS code) but I don't know how widespread that is...
i find it especially helpful in code where you have both wrapped and unwrapped versions of something floating around
thank you
I think I agree, it makes it clearer what the key is about
@mccraigmccraig as @dharrigan says, your route is a triplet of name (keyword), url->action (fn), action->url (fn). Action route goes through all url->action which either return controller action with params or nothing. The last in a row is default catchall error router.
That sounds very slow :)
Also, how do you build your sitemap automatically!
It is not slower than Sinatra’s get '/' do … end
or equivalent in almost all other frameworks out there.
For a sitemap, every router could potentially enumerate all routes the router is aware of.