Skip to content

Instantly share code, notes, and snippets.

@mkwiatkowski
Created September 17, 2011 14:18
Show Gist options
  • Save mkwiatkowski/1223974 to your computer and use it in GitHub Desktop.
Save mkwiatkowski/1223974 to your computer and use it in GitHub Desktop.
Compojure hello world application
(ns helloworld
(:gen-class)
(:use compojure.core
ring.adapter.jetty
clojure.contrib.command-line)
(:require [compojure.route :as route]))
(defroutes main-routes
(GET "/" [] "<h1>Hello World</h1>")
(route/not-found "<h1>Page not found</h1>"))
(defn -main [& args]
(with-command-line args
"Application"
[[port "Port to run the server on"]]
(run-jetty main-routes {:port (Integer/parseInt port)})))
(defproject helloworld "0.1"
:dependencies [[org.clojure/clojure "1.2.1"]
[org.clojure/clojure-contrib "1.2.0"]
[compojure "0.6.5"]
[ring/ring-jetty-adapter "0.3.11"]]
:main helloworld)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment