ip.ericb.me
Eric Bailey
Written on 13 July, 2015
Updated on 18 December, 2023
Tags: hack, clojure, web-service, open-source
As an exercise, I've written my own IP echo service
and am running it at ip.ericb.me.
Its excruciatingly simple Clojure source looks something like the following.
(defroutes app (GET "/" {{x-real-ip "x-real-ip"} :headers} {:status 200 :headers {"Content-Type" "text/plain"} :body x-real-ip})) (defn -main [& args] (->> (or (some-> (env :port) (Integer/parseInt)) 5000) (hash-map :port) (run-server app)))