Fork me on GitHub
#ring-swagger
<
2016-09-12
>
jazzydag20:09:52

Hi there! I'm Clojure / ClojureScript beginner and I've some questions about compojure & ring-swagger.

jazzydag20:09:06

I would like to wrap my services route defined by the defapi macro with a /v1 or /v2 for instance. For now, I've something like

(def app-routes
  (routes
   #'service-routes
    (-> #'home-routes
        (wrap-routes middleware/wrap-csrf)
        (wrap-routes middleware/wrap-formats))
    (route/not-found
      (:body
        (error-page {:status 404
                     :title "page not found"})))))
where home-routes is defined by the defroutes macro and service-routes by the defapi macro.

jazzydag20:09:10

I tried a context such as (context "/v1" [] (service-routes)) but it didn't work, I got a Method compojure/api/routes/Route.invoke()Ljava/lang/Object; is abstract

jazzydag20:09:58

I read some docs, some code snippets, tried different stuff (with :basePath swagger parameter). I think it's nothing, but well...

jazzydag21:09:45

ok, my bad. I tried again a (context "/v1" [] #'service-routes) and it worked.

jazzydag21:09:19

sorry for the noise