-
Notifications
You must be signed in to change notification settings - Fork 64
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
Make Route Dispatching a Little Less Imperative #16
Comments
Specifically, it would be great to do something like: (let [user-handler (fn [user-id]
(print "User looked up: " user-id))
test-routes (-> {}
(secretary/assoc-route :v1-channel-link "/v1/channels/:channel-id" channel-handler)
(secretary/assoc-route :v1-user-link "/v1/users/:user-id" user-handler))]
(secretary/dispatch! test-routes "/v1/users/10")) And have everything self-contained/referentially transparent |
Definitely. This is along the lines of what we were discussing in #9. At work we've encountered some situations where this functionality would be nice. Ideally, it'd be nice to have something along the lines of (defroutes death-routes
(route poison-path "/poison/:type" ...)
(route stab-path "/stab/:with" ..)) which would essentially expand to the code @sgrove shared above in |
Mmm—I like the sounds of that 👍 |
Should we bump to |
Yeah, sounds good. |
Question: Should we also implement |
Let's hold off for now. And do it later if we need it. |
|
I agree, but perhaps in a different PR. |
Alright, good idea. |
I've started work on this in a separate branch here. The current syntax looks like (defroutes routes-name
(ROUTE users-path "/users" [])
(ROUTE user-path "/users/:id" [id])
(ROUTE user-edit-path "/users/:id/edit" [id])) This defines an instance of a new type If anyone has questions or ideas let me know. 😄 |
Allow routes to be dispatched from (and optionally defined to?) different collections. This'll make things like testing and optional routes easier to work with.
E.g.:
Thanks for the suggestion, @sgrove.
The text was updated successfully, but these errors were encountered: