Skip to content

Instantly share code, notes, and snippets.

@c-garcia
Created December 2, 2015 21:19
Show Gist options
  • Save c-garcia/49bde06a709f1c854e55 to your computer and use it in GitHub Desktop.
Save c-garcia/49bde06a709f1c854e55 to your computer and use it in GitHub Desktop.
A minimal webapp returning a JSON map of a word passed within the URI (http://host:port/uppercase/:word
(defroutes webapp
(GET "/uppercase/:text" [text]
(do
(debug "Received request for" text)
(-> (r/response (json/write-str {:status :ok :text (s/upper-case text)}))
(r/content-type "application/json"))))
(route/not-found
(do
(debug "Unknown route")
(-> (r/response (json/write-str {:status :err :reason :op-not-found}))
(r/content-type "application/json")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment