Created
March 28, 2011 13:58
-
-
Save rippinrobr/890500 to your computer and use it in GitHub Desktop.
Final core.clj file
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 hello-clojure-web.core | |
(:use compojure.core) | |
(:require [compojure.route :as route] | |
[compojure.handler :as handler]) | |
(:use ring.middleware.reload) | |
(:use ring.adapter.jetty)) | |
(defn handler [req] | |
{:status 200 | |
:headers {"Content-Type" "text/html"} | |
:body "Hello Clojure Web - brought to you by... Ring!" }) | |
(defn boot [] | |
(run-jetty (wrap-reload #'handler '(hello-clojure-web.core)) {:port 8080})) | |
(defroutes my-routes | |
(GET "/" [] "<p>Hello Compojure!</p>") | |
(GET "/hi/:name" [name] (str "<p>Hi " name "</p>")) | |
(POST "/posttest/:val" [val] (str "post test val was " val)) | |
(route/not-found "Page not found")) | |
(def app (handler/site my-routes)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment