Created
May 20, 2011 01:21
-
-
Save zippy/982163 to your computer and use it in GitHub Desktop.
compojure problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns cmp.core | |
(:use compojure.core, ring.adapter.jetty) | |
(:require [compojure.route :as route] | |
[compojure.handler :as handler]) | |
) | |
(defn view-form [] | |
(str "<html><head></head><body>" | |
"<form method=\"post\">" | |
"Data <input type=\"text\" name=\"data\"/>" | |
"<input type=\"submit\"/>" | |
"</form></body></html>")) | |
(defroutes main-routes | |
(GET "/" [] (view-form)) | |
(POST "/" [data] (str "data:" data)) | |
(route/not-found "Page not found")) | |
(def app | |
(handler/site main-routes)) | |
(comment let [t (Thread. #(run-jetty main-routes {:port 8080}))] | |
(doto t .start)) | |
(run-jetty main-routes {:port 8080}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment