I’m trying to find out what special formatting I can use in the :summary blocks for API methods in Compojure-API? So far I haven’t stumbled across it in the docs…
@staypufd Swagger-UI supports markdown formatting
@petr.mensik I haven’t used wrap-reload
is a long time, but the reloaded-workflow instead where the reset reloads all the routes, so not sure how that works. One thing that could help is to use the subroutes as Vars if they are in different namespaces.
(api
#'users/user-routes)
, with this, the route reference is re-evaluated each time there is a request. Not sure if that works. I recommend the reloaded workflow.another thing, I would use :middleware
option of the api
instead of route-middleware
. e.g.
(api
{:middleware [[wrap-resource resource-root]]}
...)
[metosin/compojure-api "2.0.0-alpha14"]
is out, with a updated version of Muuntaja: the :allow-empty-input?
didn’t work properly causing random nil
on input.
Not sure should we wait for clojure.spec to ship before putting the 2.0.0 out. Has taken 1.5+ year so far…
I think Rich is doing something functional with spec, so everything might break. would like to wait until we see what it looks like before launching.
maybe some depreceations (`defapi` & defroutes
), proper docs and then… wait.
Thank you, middleware key worked for me.
@petr.mensik yes you can, and should. There is a good example project with all-the-stuff at https://github.com/yogthos/memory-hole
Hi guys.
silly question but, I just wanted to get params from my json request client.
Is there any example ?
I use ring-json library and I just want to get :json-params value.
hi! the parameters are found in :body-params
regardless of the encoding.
I wrap my handler with json wrappers provided by ring library. But there is no value in body-params.
api
mounts muuntaja.middleware/wrap-formats
, which does json, edn and transit, so you don’t need the ring-json on top of it.
hmm… simplest echo api would be: (api (fn [request] {:status 200, :body (:body-parameters request)}))
“send whatever, return the body-paramters in a http 200 response”
Can I get, my request map ?
Just for debugging.
request map from compojure?
sure
(POST "/echo" request
(println request)
(ok {:hello "world"}))
or
(POST "/echo" []
(fn [request]
(println request)
(ok {:thanks-to "james"})))
Thanks.
Sorry for the silly question again.
np, not a silly q. there is a nice routing guide in Luminus: http://www.luminusweb.net/docs/routes.md
Thanks again. 🐣