Created
December 2, 2015 21:19
-
-
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
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
(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