Questions tagged [ring]

Ring is a Clojure web applications library written by Mark McGranaghan. It was inspired by Python's WSGI and Ruby's Rack. By abstracting the details of HTTP into a simple, unified API, Ring allows web applications to be constructed of modular components that can be shared among a variety of applications, web servers, and web frameworks.

Ring is a Clojure web applications library written by Mark McGranaghan. It was inspired by Python's WSGI and Ruby's Rack. By abstracting the details of HTTP into a simple, unified API also known as the Ring spec, Ring allows web applications to be constructed of modular components that can be shared among a variety of applications, web servers, and web frameworks.

Mark gave a presentation which provided an overview of Ring at Clojure conj called "One Ring to Bind Them".

479 questions
12
votes
1 answer

How do I configure nginx as proxy to jetty?

I've been trying to set up nginx as proxy to jetty. I want to do something as explained in this answer but for Jetty not ring. I've created a .war and I placed it in ~/jetty/jetty-dist/webapps/web_test-0.1.0-SNAPSHOT-standalone.war Say, I want to…
Zeynel
  • 13,145
  • 31
  • 100
  • 145
12
votes
2 answers

ring-json's wrap-json-response middleware and compojure returns text/plain?

I'm trying to use ring-json's wrap-json-response middleware within my compojure app. I have a simple GET handler that returns a map, like {:foo 1}, and when I hit the URL, ring responds with text/plain and an empty response body. I can't seem to get…
Ryan
  • 7,733
  • 10
  • 61
  • 106
11
votes
1 answer

How to integrate figwheel with ring server to get back-end auto-reload?

I am new to clojure/clojurescript web development. Use lein ring server and the modifications(for example routes) will be automatically reloaded to the server(hot-deploy). Use lein figwheel, and it will spy on the changes of cljs source files and…
LotAbout
  • 707
  • 5
  • 18
10
votes
1 answer

Why does ring's resource-response respond with application/octet-stream content type?

I am trying to figure out why Ring's resource-response is choosing to respond with an application/octet-stream content type. I recently updated some sample code, that I've been learning from, so that it uses the newer ring-defaults. Prior to using…
Ryan
  • 7,733
  • 10
  • 61
  • 106
10
votes
1 answer

idiomatic way to catch exceptions in ring apps

What is the idiomatic way to handle exceptions in ring apps. I would like to capture the exception and return a 500 page. How do I do that ? I am using moustache for the code below, however it doesnt work - (def my-app (try (app …
murtaza52
  • 46,887
  • 28
  • 84
  • 120
10
votes
1 answer

Compojure/Ring: Why doesn't a session with cookie-store survive a server restart?

I have a compojure app that uses the ring session wrapper to store the OAuth token associated with the current user. I would like for this token to remain available when the server restarts, so that I don't have to go through the auth process each…
jgre
  • 787
  • 5
  • 11
10
votes
2 answers

clojure/ring/jetty: I am using > lein ring server. How do I configure the jetty instance that gets instantiated?

When I was calling the jetty handler directly, I was able to pass in a configurator like so: (def header-buffer-size 8388608) (defn start [port] (ring/run-jetty (var app) {:port port :join? false :host "127.0.0.1" :configurator …
prismofeverything
  • 8,799
  • 8
  • 38
  • 53
9
votes
2 answers

Reloading code on a production ring-clojure server

What's the best way to push new code to a production ring server without restarting the whole JVM? Currently I use wrap-reload in production, but this doesn't quite work for me because sometimes I want to run commands in the repl (doing database…
Aaron Iba
  • 625
  • 5
  • 14
9
votes
4 answers

How should javascript be integrated into a Clojure/Ring web app?

How are Javascript resources best integrated into a ring application? Specifically: Where would we put our .js files? How and where should unit tests be set up? What is the best way to set up acceptance tests for functionality that cuts across the…
Rob Lachlan
  • 14,289
  • 5
  • 49
  • 99
9
votes
2 answers

Generate and stream a zip-file in a Ring web app in Clojure

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. I feel it has something to do with flushing/streaming…
Marten Sytema
  • 1,906
  • 3
  • 21
  • 29
9
votes
3 answers

Testing POST route with anti-forgery and ring-mock

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 response))))) However, since I use the…
Robert
  • 121
  • 6
9
votes
1 answer

Is there some sort of canonical edn response we can use for ring?

I've been reading the edn spec and want to integrate it into my application. However, I don't know how to transfer edn requests between clojure and client. Do we put a content-type application/edn in the response header and just send the prn output…
zcaudate
  • 13,998
  • 7
  • 64
  • 124
9
votes
2 answers

how do i mock a json post request in ring?

I'm using peridot - https://github.com/xeqi/peridot to test my ring application, and its working fine until I try to mock a post request with json data: (require '[cheshire.core :as json]) (use 'compojure.core) (defn json-post [req] (if (:body…
zcaudate
  • 13,998
  • 7
  • 64
  • 124
9
votes
0 answers

a directory explorer middleware for ring clojure

Are there any available middleware for ring that would mimic the way a standard file server like apache handles routes so the handler would look something like this: (wrap-dir "resources/public/") which is very similar to (wrap-file…
zcaudate
  • 13,998
  • 7
  • 64
  • 124
8
votes
1 answer

ring/compojure without jetty

I know it's possible to create a war file using lein ring war, but it seems to still include jetty dependencies. Is there a way to exclude the jetty dependencies when I'm building the war (and deploying on tomcat)? If I can't does this matter at…
Kevin
  • 24,871
  • 19
  • 102
  • 158
1
2
3
31 32