Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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