What is the proper way to declare an optional query parameter, with default value, when using compojure-api?
One of my route elements is as follows (after reading this):
(GET "/:id/descendants" [id]
:return [d/CategoryTreeElement]
…
What's the difference between using :body-params and :form-params in practice when creating an API using compojure-api? For example:
(POST* "/register" []
:body-params [username :- String,
password :- String]
…
for example the Luminus website states that
Compojure route definitions are just functions that accept request
maps and return response maps...
(GET "/" [] "Show something")
...
But compojure routes are not functions
(defmacro GET "Generate a…
When I have a definition of an API like this:
(POST* "/register" []
:body-params [username :- String,
password :- String,
name :- String]
(ok)))
what's the appropriate way of making name optional? Is…
Not certain why when I lein with-profile +live ring uberjar and then java -jar my uberjar, I get this exception: java.lang.NoClassDefFoundError: clojure/lang/Var.
project.clj:
(defproject gn-preview-api "0.1.0-SNAPSHOT"
:description "FIXME: write…
I am trying to implement request end point authentication. For that I want to access accessToken value from request headers.
My GET request end Point is
CURL Command
curl -X GET \
'http://localhost:3000/hello?id=10' \
-H 'accesskey:…
I'm trying to learn Clojure, and am blocked up around the literal function syntax. I can't figure out what the literal function equivalent of (defn fourteen [] 14) is.
(def fourteen (fn [] 14))
;; => #'user/fourteen
(fourteen)
;; => 14
(defn…
Application uses kabab-case key formatting for schema like below
(s/defschema User
{:first-name s/Str
:last-name s/Str})
But for swagger docs I want the schema in camelCase like…
How can I add CORS to this code snippet?
(def app
(api
{:swagger {:ui "/docs"
:spec "/swagger.json"}}
(GET "/route-a" [] "a")
(GET "/route-b" [] "b")
(GET "/route-c" [] "c")))
I would like to…
I am using ring adapter jetty server in my compojure api project. Now I want to add ring middleware CORS to my Project. How should I add and where should I add ring middleware CORS in my project?
These are my project code snippets
API
(ns…
I am playing with compojure-api and am blocked at trying to manage Content-Type for my simple webapp. What I want is to emit an HTTP response that is just plain/text, but somehow Compojure-API keeps setting it to "application/json".
(POST…
In compojure-api I noticed this two ways of specifying the API of a resource:
(POST* "/register" []
:body [user UserRegistration]
(ok)))
and
(POST* "/register" []
:body-params [username :- String,
password :- String]
…
wrap-cors does not return access control headers when there is a bad request against my api endpoint. I believe this is because I am using a exception handler which might be blocking the middleware from running. I want to know how I can still…
My middleware is throwing an error only for async requests, not sure why:
project.clj
(defproject asyncy "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.9.0"]
…
Here, I am using the metosin/compojure-api library, to configured a GET /fetch endpoint for my api. You will see that I am also using plumatic/schema to validate the query-parameter inputs on this endpoint and siilisolutions/humanize to humanise any…