Skip to content

Instantly share code, notes, and snippets.

@andrewvc
Created December 2, 2011 06:21
Show Gist options
  • Save andrewvc/1422042 to your computer and use it in GitHub Desktop.
Save andrewvc/1422042 to your computer and use it in GitHub Desktop.
Noir Examples
; Define the route, and specify that we want the 'garden-file' param
(defpage [:post "/upload"] {:keys [garden-file]}
; do some work
(let [{:keys [decoded-file uuid]} (decode-upload garden-file)]
(try
(garden/create uuid decoded-file)
(finally
(.delete decoded-file)))
; render some HTML based on that work
(common/layout [:p (format "File %s was created" uuid)]))
(defpage "/welcome" []
"Welcome to Noir!")
(html/html5 [:h2 "◉ Recent Gardens"]
[:ul {:id "recent"}
(map (fn [uuid] [:li (link-to (str "/gardens/" uuid) uuid)])
(garden/recent))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment