Skip to content

Instantly share code, notes, and snippets.

@rippinrobr
Created March 28, 2011 13:58
Show Gist options
  • Save rippinrobr/890500 to your computer and use it in GitHub Desktop.
Save rippinrobr/890500 to your computer and use it in GitHub Desktop.
Final core.clj file
(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