-
-
Save devn/3acd0c210113721eb024 to your computer and use it in GitHub Desktop.
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
(ns an.aot.shim) | |
(def service-ns "an.aot.server") | |
(def handler* (atom nil)) | |
(def handler (fn [request] (@handler* request))) | |
(defn init [] | |
(require (symbol service-ns)) | |
((resolve (symbol service-ns "init"))) | |
(reset! handler* ((resolve (symbol service-ns "handler"))))) |
Specifically, you'd use this for a ring application. In your leiningen project.clj:
:ring {:handler an.aot.shim/handler
:init an.aot.shim/init
:port 3333
:open-browser? false
:nrepl {:start? true :port 9999}
:stacktraces? false}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you find yourself reading this, this is to avoid transitive AOT in a clojure application. This ensures that namespaces required from
an.aot.server
are not transitively AOT compiled.