what’s the best practice for combining routes from multiple namespaces in a ring app using compojure?
for example if you had a lists and items namespace with a route.clj using the defroutes macro
is there a common pattern for bringing all those routes together in your app’s core.clj or perhaps a top level route.clj?
@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
@mgrbyte thanks, i’ll take a look at this 👍
@mgrbyte so you’re essentially just storing all the routes (defined via defroutees) from each namespace in a vector called all-routes
yes?
yes
don’t you need to combine/merge these then?
https://github.com/WormBase/datomic-to-catalyst/blob/develop/src/rest_api/main.clj#L149-L151
@chadhs yes, ☝️ all-routes
flattened, then given to compojure.api.sweet/routes
nice! i was thinking about something like this, but didn’t know if it was idiomatic.
seems reasonable to me either way thanks for your help @mgrbyte