Last active
March 12, 2019 15:30
-
-
Save visibletrap/064b7fd8524c114960a717ef166d6abf to your computer and use it in GitHub Desktop.
deps.edn + ring + compojure as a single executable shell script file. Inspired by https://gist.github.com/ericnormand/6bb4562c4bc578ef223182e3bb1e72c5
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
#!/bin/sh | |
#_( | |
DEPS=' | |
{:deps {org.clojure/clojure {:mvn/version "1.10.0"} | |
ring/ring-core {:mvn/version "1.7.1"} | |
ring/ring-jetty-adapter {:mvn/version "1.7.1"} | |
compojure {:mvn/version "1.6.1"}}} | |
' | |
exec clojure -Sdeps "$DEPS" "$0" "$@" | |
) | |
(require '[compojure.core :refer [routes GET]] | |
'[compojure.route :as route] | |
'[ring.adapter.jetty :refer [run-jetty]]) | |
(def handler | |
(routes | |
(GET "/" [] "<h1>Hello World 1</h1>") | |
(route/not-found "<h1>Page not found</h1>"))) | |
(run-jetty handler {:port 3000}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment