Skip to content

Instantly share code, notes, and snippets.

@Raynes
Created May 7, 2010 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raynes/393814 to your computer and use it in GitHub Desktop.
Save Raynes/393814 to your computer and use it in GitHub Desktop.
(ns tryclojure.core
(:use ring.adapter.jetty
[hiccup core form-helpers]
[ring.middleware reload stacktrace params]
net.cgrand.moustache))
(defn fire-html [text]
(html
[:h1 "HAI!"]
[:p "What's up?"]
[:div {:style "overflow:auto;height:100px;"} text]
(form-to [:post "/"]
(text-field "code" "GIB ME UR CODEZ.")
(submit-button "Submit."))))
(defn handler [{fparams :query-params}]
{:status 200
:headers {"Content-Type" "text/html"}
:body (fire-html (fparams "code"))})
(def clojureroutes
(app
(wrap-params)
(wrap-stacktrace)
[""] handler))
(run-jetty #'clojureroutes {:port 8081})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment