Re: Chaining compojure routes
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" [] "Hello Foo!")) >"bar" (routes > (GET "/bar/baz" [] "Hello Foo!") > (GET "/bar/quux" [] "Hello Quux!"))}) > > (def test-r > (routes >(GET "/hey" > [] > "HEY!") >(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 clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Chaining compojure routes
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" [] "Hello Foo!")) "bar" (routes (GET "/bar/baz" [] "Hello Foo!") (GET "/bar/quux" [] "Hello Quux!"))}) (def test-r (routes (GET "/hey" [] "HEY!") (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 clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Chaining compojure routes
On Feb 12, 2016 4:40 PM, "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" [] "Hello Foo!")) >"bar" (routes > (GET "/bar/baz" [] "Hello Foo!") > (GET "/bar/quux" [] "Hello Quux!"))}) > > (def test-r > (routes >(GET "/hey" > [] > "HEY!") >(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? > core/context? > Thanks. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > 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 clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.