Created
April 6, 2012 20:41
-
-
Save yogthos/2322780 to your computer and use it in GitHub Desktop.
simple Noir app
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 small-site.server | |
(:require [noir.server :as server] | |
[noir.content.pages :as pages] | |
[clj-http.client :as client]) | |
(:use noir.core | |
hiccup.core | |
hiccup.page-helpers)) | |
(def code (slurp "src/small_site/server.clj")) | |
(def hilite-url "http://hilite.me/api") | |
(def params {:form-params {:code code :lexer "clojure"}}) | |
(def response (:body (client/post hilite-url params))) | |
(defpage "/" [] | |
(html5 | |
[:head | |
[:title "small-site"]] | |
[:body | |
[:h3 "I am the smallest Noir app!"] | |
[:p "Here is my source code:"] | |
[:p response]])) | |
(defn -main [& args] | |
(let [mode (keyword (or (first args) :dev))] | |
(server/start 8080 {:mode mode :ns 'small-site}))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment