Questions tagged [compojure-api]

Stuff on top of Compojure for making sweet web apis.

You can read more about it at https://github.com/metosin/compojure-api

51 questions
1
vote
1 answer

Compojure Rest API: Show body response in JSON format

I am new to compojure api. How can I show body response in JSON format? Here is the code what I have written core.clj (ns clojure-dauble-business-api.core (:require [compojure.api.sweet :refer :all]) (:require [ring.util.http-response :refer…
Srini
  • 823
  • 5
  • 10
  • 29
1
vote
1 answer

Clojure - Ring Stream Response

I am getting a ring stream response which I do not know how to deal with. I passed in a parameters to my ajax POST and when it gets to the function in my compojure route, instead of being the original parameter I passed in, I get a ring stream…
rbb
  • 989
  • 6
  • 19
1
vote
1 answer

avoiding repetition while using schema.core

I have defined the following schema: (s/defschema Card {:cardNumber s/Str :cvv s/Str :creditCardMonthValidity s/Str :creditCardYearValidity s/Str :cpf s/Str :name s/Str :phoneNumber s/Str}) and then in a route I'm using the same keys…
prog keys
  • 687
  • 1
  • 5
  • 14
1
vote
1 answer

Compojure-api removes body-param after the first group of API routes

I am currently using the Luminus template with the +swagger option, which adds compojure-api support. My current setup is like so (only relevant bits): (ns my-project.routes.services (:require [compojure.api.sweet :refer :all] …
Alan Tran
  • 58
  • 6
1
vote
1 answer

Compojure-Api return vector of schema objects

I have started learning Luminus framework to get into Clojure(script) for web applications. For RESTful services framework suggests using swagger/compojure-api. Examples were helpful, but I can't find any for returning collections. Here is my…
fevgenym
  • 568
  • 7
  • 20
1
vote
1 answer

Compojure: How to get query parameters as a map

I just created my RESTful service through Luminus using this doc: http://www.luminusweb.net/docs/services.md Apparently Compojure-API uses Schema library to map the query parameters. However, I would like to be able to get all the query parameters…
Gustavo Matias
  • 3,508
  • 3
  • 27
  • 30
1
vote
1 answer

How do I access the session in a compojure-api handler?

Using compojure-api, as in: (defapi app (swagger-ui) (swagger-docs {:info {:title "Sample api"}}) (GET* "/" [] :no-doc true (ok "hello world")) (context* "/api" [] :tags ["thingie"] (GET* "/plus" [] :return …
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
1
vote
1 answer

ring.middleware.format_params.cjl throws on malformed JSON

I use luminus template with ring/compojure/swagger setup. When I feed the REST API i created malformed JSON i get 500 and: java.lang.IllegalArgumentException: No value supplied for key: {:formats (:json-kw :yaml-kw :edn :transit-json…
Terminus
  • 925
  • 10
  • 23
0
votes
2 answers

slow build response in compojure-api

I have been using compojure-api to build a server and I have an endpoint that returns json to the client. Now the problem: it seems to me that it is taking too much time to build the response to send back to the client. Here is my log. It shows that…
0
votes
1 answer

Compojure API running ring server raises map exception

I'm following this tutorial on how to use the compojure api and have run into a dead end with this exception: lein ring server 2022-08-09 23:19:55.538:INFO::main: Logging initialized @921ms WARN clojure.tools.logging not found on classpath,…
Jack Gee
  • 136
  • 6
0
votes
1 answer

clojure: PUT to server always returns 404

I have a server hosting my API. My API relies on data requested from a third-party API (Spotify). Here are the relevant parts of my API handler: (ns myapp.api.handler (:require [compojure.api.sweet :refer :all] [ring.util.http-response…
duplic8
  • 109
  • 1
  • 9
0
votes
1 answer

compojure api + allow CORS

I am trying to set my simple server to allow CORS. I am making a request localhost from a clojurescript application that I am making. I have given a search, for example this answer: How do I add CORS to a compojure-api app?. But from what I can see,…
0
votes
1 answer

Clojure nested json response

I am new to clojure and I am trying to make a simple API with 3 endpoints. I am trying to implement an endpoint which will take each row of a query and put it to a json. So I have an SQLite database. These are my entries for example: {:timestamp…
0
votes
1 answer

How do I make middleware to put a response header only when `:swagger {:deprecated true}`?

We use the compojure-api to get us some nice swagger integration in our ring apps. The :swagger {:deprecated true} meta works like a champ to get the swagger page correct, but I have a requirement that I put a specific header on the response when…
Bob Kuhar
  • 10,838
  • 11
  • 62
  • 115
0
votes
1 answer

Exception when attempting to run Cloverage with compojure auth middleware

Cloverage is now failing after I adding role based authentication to my compojure api. Whilst running lein cloverage I get this exception: Exception in thread "main" java.lang.IllegalArgumentException: No method in multimethod 'restructure-param'…
Freid001
  • 2,580
  • 3
  • 29
  • 60