Skip to content

Instantly share code, notes, and snippets.

@visibletrap
Last active March 12, 2019 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save visibletrap/064b7fd8524c114960a717ef166d6abf to your computer and use it in GitHub Desktop.
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
#!/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