From bd8d737758335c8d55829ec362c6fc7dd4ee20d5 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Tue, 26 Mar 2024 21:07:26 +0200 Subject: [PATCH] Add the simple endpoint and the configuration. --- shadow-cljs.edn | 6 +++++- src/main/blog/core.cljs | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/main/blog/core.cljs diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 5d85084..ef7c500 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -8,4 +8,8 @@ [] :builds - {}} + {:node {:target :node-script + :output-to "public/index.js" + :main blog.core/main + :init-fn blog.core/main}}} + diff --git a/src/main/blog/core.cljs b/src/main/blog/core.cljs new file mode 100644 index 0000000..be61ffc --- /dev/null +++ b/src/main/blog/core.cljs @@ -0,0 +1,15 @@ +(ns blog.core + (:require ["express" :as express])) + +(def app (express)) +(def port 3000) + +(defn main [] + (. app get "/" + (fn [req res] + (. res send "Hello world"))) + + (. app listen port + (fn [] + (println "Listen on " port)))) +