How do I bind a dynamic variable in compojure? Please see my example below, here the request-id is a unique uuid which is generate for each api request. I would like to be able to access this request-id in subsequent methods for logging etc. I have…
I've a luminus project with some simple compojure-api routes.
I've added carmine to communicate with a redis server, using the wcar* macro (defined in services.clj) to make calls to it, and everything works fine.
Now I'm trying to add some tests,…
I'm trying to use the ring.mock.requests library to test an http service. I have this bit of code
(auth-routes
(->
(mock/request :post "/auth/user")
(mock/body {:username "user" :password "pass"})
(mock/content-type…
I have a Clojure based web application using Angular JS. All the REST APIs are written in Clojure using Compojure and Ring. Now we want to host our application on a AWS Fargate instance which is a Spring Boot application.
I have been looking for a…
Suppose you have schema like below
(s/defschema House
{:bedroom s/Int
:bathroom s/Int
:parking s/Int
})
The dynamic generation of swagger docs will assign a default value of 0.
How do I assign default value for bedroom, bathroom, and…
I am using plumatic/schema with my compojure-api to validate the input for an endpoint.
I have two keys in my schema: Field1 & Field2. I want to be able to define a rule for my schema which for example says:
WHEN Field1 = "AA"
THEN Field2 is…
I have a route for which I have to get all of parameters from body.
I have no choice because it will be called from a third party system so I have to work with simple tools. I also don't have complete control of the data that is passed and I need…
I'm using ring-swagger via compojure-api. I have a few query parameters and I'm struggling to find a way to add a description to a single query parameter. I can add the summary of the entire endpoint but that's not enough.
Is it possible to add a…
I'm very new to the Clojure-Compojure API development. I have a requirement where I need to create a static html page for every post to my api, fill the content with posted body including styles and a url has to be generated to point to that static…
I'm trying to set up a simple middleware in a luminus project that uses compojure and ring. I'm sure I'm missing something simple, but I've set up a simple middleware to test and I'm not getting the results I expect.
(defn wrap-api-auth [handler]
…
I'm starting on functional programming now and I'm getting very crazy of working without variables.
Every tutorial that I read says that it isn't cool redefine a variable but I don't know how to solve my actual problem without saving the state on a…
I would like to be able to json encode an exception object. I am pushing my logs to sumologic and would like to be able to push json encoded exception's so that I can parse and filter these logs in sumo too.
However, I can't json encode the…
I'm using compojure-api, and I'm looking for a function that, given my api route structure thingie and a request, returns the Route record (or :name) for that request, without applying its handler.
I've been able to find kind of the inverse of what…
I am passing path parameter to fetch data from Database.
End Point
http://localhost:3000/hello/1000
GET Method Code
Code
(ns clojure-dauble-business-api.core
(:require [compojure.api.sweet :refer :all]
[ring.util.http-response :refer…
I am new to clojure. I want to fetch x records with fields from database and want to insert records into database. Which once should I use between defrecord and defschema in this scenario?
Are those the same?