ring Questions
9
Solved
I want to use post to update a database and don't want people doing it manually, i.e., it should only be possible through AJAX in a client. Is there some well known cryptographic trick to use in th...
3
Solved
With the following app:
; src/webapp/core.clj
(ns webapp.core
(:require [compojure.core :refer [defroutes GET]]
[ring.middleware.json :as mid-json]
[clj-time.jdbc]))
(defn foo [request]
{:bod...
4
Solved
I'm writing some middleware for Ring and I'm really confused as to why I have to reverse the order of the middleware.
I've found this blog post but it doesn't explain why I have to reverse it.
H...
4
Solved
Suppose I want to delete a cookie (for example, ring's session cookie):
Making a response map like this:
{:cookies {"ring-session" {:value "kill", :max-age 1}}}
seems to work, but it feels a bi...
Gilstrap asked 10/1, 2013 at 13:18
3
Solved
I am writing a web application using ring and clojure. I am using the jetty adapter for the development server and emacs/SLIME for IDE. While wrap-reload does help, run-jetty blocks my slime sessio...
2
Solved
I have a Ring handler that needs to:
Zip a few files
Stream the Zip to the client.
Now I have it sort of working, but only the first zipped entry gets streamed, and after that it stalls/stops....
3
Solved
When handling a http request inside a ring server, the body of the request-data is stored in the request-hashmap in the key :body. For instance as followed:
#object[org.eclipse.jetty.server.HttpI...
3
Solved
How does one inject state into ring handlers most conveniently (without using global vars)?
Here is an example:
(defroutes main-routes
(GET "/api/fu" [] (rest-of-the-app the-state)))
(def app
...
Munificent asked 4/11, 2013 at 20:24
1
I have the following system.components middleware config, in which I'm using the ring.middleware wrap-cors, to allow for redirects to an external server:
(defn config []
{:http-port (Integer. (or...
Isomorph asked 5/3, 2020 at 0:44
3
Solved
According to the Compojure documentation on routes, I can easily get individual parameters like this:
(POST "/my-app" [param1 param2]
(str "<h1>Hello " param1 " and " param2 "</h1>"))...
3
Solved
In Clojure / Compojure, how do I convert a map to a URL query string?
{:foo 1 :bar 2 :baz 3}
to
foo=1&bar=2&baz=3
Is there any utility method to do this in compojure?
2
I'd like to use figwheel to reload the frontend of an all-clojure project I'm playing with.
The backend serves a REST api and is organized as a bunch of components from which I create a system in...
3
Solved
(ns ...
(:require [ring.util.response :refer [ response redirect]))
My original code be-all-like
(-> (response "You are now logged in! communist party time!")
(assoc :session new-session)
...
Confident asked 7/3, 2015 at 0:55
3
I want to write a test for a simple POST request using ring.mock - something like this:
(testing "id post route"
(let [response (app (mock/request :post "/" {:id "Foo"}))]
(is (= 302 (:status re...
1
Solved
I keep getting "Invalid anti-forgery token" when wrapping specific routes created with metosin/reitit reitit.ring/ring-router. I've also tried reitit's middleware registry, but it didn't work too. ...
1
Solved
I am creating a simple API which returns JSON data back to the user. For development purposes, I would like to enable CORS so that my react frontend can call the API locally. For the moment, it com...
6
I'm using Clojure (ring and compojure) to build a web app and I don't know where to start with https. I have a registration and login that will need to be secured, then once they're authenticated t...
3
What is the correct workflow/pathway of usage of emacs/cider while developing
a compojure/ring-based clojure application?
I feel that I can "attach" to my running compojure/ring-process,
change it...
2
Solved
I am making a Messenger bot and I am using Ring as my http framework.
Sometime I want to apply delays between messages sent by the bot. My expectation would be that it is safe to use Thread/sleep ...
1
Solved
I have a skeletonized voxel structure that looks like this:
The actual structure is significantly larger than this exampleIs there any way to find the closed rings in the structure?
I tried conv...
Milreis asked 26/4, 2017 at 12:11
1
I need to create on the fly excel file on request and serve it to user via response, using clojure.ring.
I use docjure to create an excel file and write it to the output stream
(see this function...
2
The ClojureScript cljs-ajax client library converts {:b [1 2]} to b[0]=1&b[1]=2
For example:
(http/get "http://example.com" {:b [1 2]})
results in a request to:
"http://example.com?b[0]=1&...
2
Solved
I have a ring+compojure application and I want to apply different middleware depending on whether the route is part of the web application or part of the api (which is json based).
I found some a...
1
Solved
I am following this tutorial building a Clojure backend
and I'm not exactly well versed in Clojure.
The tutorial provides this source file
(ns shouter.web
(:require [compojure.core :refer [defro...
1
Solved
I was led to believe that Pedestal is a replacement for Ring however from all the examples I see that Pedestal actually uses Ring. This is most confusing! Do I need to know and understand how Ring ...
1 Next >
© 2022 - 2025 — McMap. All rights reserved.