For more info on core/context
see: https://github.com/weavejester/compojure/wiki/Nesting-routes
Alan
On Friday, February 12, 2016 at 2:40:30 PM UTC-8, JvJ wrote:
>
> I'm just starting to use ring/compojure to create web apps.
>
> One thing I would like to do is have an updatable collection of apps that
> can be accessed based on the URL input.
>
> For example, if I have an app named "foo", then website.com/foo would
> redirect to that app.
>
> So far, I have the following implementation:
>
> (def route-m
> {"foo" (routes (GET "/foo" [] "<h1>Hello Foo!</h1>"))
> "bar" (routes
> (GET "/bar/baz" [] "<h1>Hello Foo!</h1>")
> (GET "/bar/quux" [] "<h1>Hello Quux!</h1>"))})
>
> (def test-r
> (routes
> (GET "/hey"
> []
> "<h1>HEY!</h1>")
> (GET "/:app*" [app]
> (route-m app))))
>
>
> The issue with this method is the fact that the "sub-routes" need to have
> the full path instead of just the sub-path. For example, "foo" needs to
> define its routes in terms of "foo/..." instead of just "/...".
>
> Is there any way around this?
>
> Thanks.
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.