Hello,
just a quick and dirty hack I use to get the best of default
dispatch-... for my use-case when dispatching API requests:
(define-for-syntax (dispatch-api-case-helper stx)
(syntax-parse stx
(((method:id (path+args:expr ...) proc:id) rest ...)
#`((("api" path+args ...) #:method
Meanwhile here's my attempt at doing a koyo-like url generation with a
wrapper around web-server/dispatch's url-generating function:
(define-values (app-dispatch app-url)
(dispatch-rules ; the standard one
[...]))
(define (app-url/names route-name . args)
;; define a mapping between
Thank you for sharing this!
I'm wondering, if this is a common use case, maybe it is worth adding to
web-server/dispatch in some form?
Or, if not, maybe we can extend the documentation to include some hints
on how to approach this otherwise?
It is great to have powerful libraries outside the
I solved this in koyo by defining an alternate version[1] of
`dispatch-rules' whose generated `reverse-uri' functions take route
names rather than functions as arguments:
https://koyoweb.org/dispatch/index.html#%28form._%28%28lib._koyo%2Fdispatch..rkt%29._dispatch-rules%2Broles%29%29
The
Oops, small correction:
> The x-expressions need to include hyperlinks to urls
> defined via dispatch-rules in main.rkt, i.e., call the url-generating
> function.
Should be `routing.rkt` instead of `main.rkt`.
--
Yury Bulka
https://mamot.fr/@setthemfree
#NotOnFacebook
Yury Bulka writes:
>
Dear Racket community,
First of all I want to say hello since this is my first post here.
I have a question about using the url dispatch library:
https://docs.racket-lang.org/web-server/dispatch.html
More specifically about the url-generation function in the context of
inter-module
6 matches
Mail list logo