ring

chadhs 2017-10-06T14:25:44.000324Z

what’s the best practice for combining routes from multiple namespaces in a ring app using compojure?

chadhs 2017-10-06T14:26:13.000283Z

for example if you had a lists and items namespace with a route.clj using the defroutes macro

chadhs 2017-10-06T14:26:39.000380Z

is there a common pattern for bringing all those routes together in your app’s core.clj or perhaps a top level route.clj?

mgrbyte 2017-10-06T14:33:48.000206Z

@chadhs that's what we do - not sure if that's best practice or not: https://github.com/WormBase/datomic-to-catalyst/blob/develop/src/rest_api/main.clj

chadhs 2017-10-06T14:34:39.000140Z

@mgrbyte thanks, i’ll take a look at this 👍

chadhs 2017-10-06T14:42:47.000140Z

@mgrbyte so you’re essentially just storing all the routes (defined via defroutees) from each namespace in a vector called all-routes yes?

mgrbyte 2017-10-06T14:43:13.000018Z

yes

chadhs 2017-10-06T14:43:18.000406Z

don’t you need to combine/merge these then?

mgrbyte 2017-10-06T14:46:03.000558Z

@chadhs yes, ☝️ all-routes flattened, then given to compojure.api.sweet/routes

chadhs 2017-10-06T14:47:51.000330Z

nice! i was thinking about something like this, but didn’t know if it was idiomatic.

chadhs 2017-10-06T14:48:01.000560Z

seems reasonable to me either way thanks for your help @mgrbyte