diff --git a/serving/samples/helloworld-clojure/README.md b/serving/samples/helloworld-clojure/README.md index 9c96f44ad72..0e98701717e 100644 --- a/serving/samples/helloworld-clojure/README.md +++ b/serving/samples/helloworld-clojure/README.md @@ -36,7 +36,9 @@ following instructions recreate the source files from this folder. "!\n")}) (defn -main [& args] - (run-jetty handler {:port 8080})) + (run-jetty handler {:port (if-let [port (System/getenv "PORT")] + (Integer/parseInt port) + 8080)})) ``` 1. In your project directory, create a file named `project.clj` and copy the code diff --git a/serving/samples/helloworld-clojure/src/helloworld/core.clj b/serving/samples/helloworld-clojure/src/helloworld/core.clj index da005104063..abbcb308fba 100644 --- a/serving/samples/helloworld-clojure/src/helloworld/core.clj +++ b/serving/samples/helloworld-clojure/src/helloworld/core.clj @@ -12,4 +12,6 @@ "!\n")}) (defn -main [& args] - (run-jetty handler {:port 8080})) + (run-jetty handler {:port (if-let [port (System/getenv "PORT")] + (Integer/parseInt port) + 8080)}))