Created
May 13, 2012 09:10
-
-
Save alexott/2687096 to your computer and use it in GitHub Desktop.
Example of web-service for hashing
This file contains hidden or 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 hbr-clj | |
(:use compojure.core ring.middleware.reload clojure.data.json) | |
(:require [compojure.route :as route]) | |
(:import [org.apache.commons.codec.digest DigestUtils])) | |
(defroutes my-routes | |
(GET "/md5/:what" [what] (json-str {:what what :hash (DigestUtils/md5Hex what)})) | |
(route/not-found "<h1>Page not found</h1>")) | |
(def app (-> #'my-routes | |
(wrap-reload '[hbr-clj]))) |
This file contains hidden or 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
(defproject hbr-clj "0.0.1" | |
:description "Example of web service" | |
:dependencies [[org.clojure/clojure "1.3.0"] | |
[compojure "1.0.4"] | |
[org.clojure/data.json "0.1.2"] | |
[commons-codec "1.6"]] | |
:dev-dependencies [[lein-ring "0.6.1"]] | |
:ring {:handler hbr-clj/app} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment