Permalink
Browse files

Add separate endpoint for comment text.

  • Loading branch information...
1 parent 0433bc1 commit 9aa60c2aff242111e0b55019737682fe7953bc36 @technomancy committed Mar 29, 2013
Showing with 12 additions and 2 deletions.
  1. +5 −0 src/lein_survey/results.clj
  2. +7 −2 src/lein_survey/web.clj
@@ -216,3 +216,8 @@
(defn image [id]
(java.io.ByteArrayInputStream. (image-bytes id)))
+
+(defn comments []
+ (string/join "\n----------------"
+ (for [{:keys [body]} (get-results)]
+ (get body "Other comments?"))))
View
@@ -41,7 +41,10 @@
{:status 200
:headers {"Content-type" "application/x-clojure"}
:body (results/results-str)}
- (= "/results/2012" (:uri req))
+ (= "/comments.txt" (:uri req))
+ {:status 200
+ :headers {"Content-type" "text/plain"}
+ :body (results/comments)}
{:status 200
:headers {"Content-type" "text/html"}
:body (render/layout (results/summary))}
@@ -64,4 +67,6 @@
(defn -main []
(let [port (Integer. (or (System/getenv "PORT") 5005))]
- (jetty/run-jetty #'app {:port port})))
+ (jetty/run-jetty #'app {:port port :join? false})))
+
+;; (def server (-main))

0 comments on commit 9aa60c2

Please sign in to comment.