A "Hello, world" HTTP server example running ClojureScript on Deno.
Run:
npm install
Start shadow-cljs with:
npm run shadow
Start the Deno process in a second terminal with:
npm run deno
This will compile the ClojureScript into an ECMAScript module and load it in Deno. Visit http://localhost:8080 for a warm greeting.
Hot reloading does not work, but you can connect to the shadow-cljs nREPL on
port 6001
. There run:
(shadow/repl :main)
Type in:
(js/console.log "hello")
To print something on the stdout of the Deno process.
Open src/main/core.cljs
change the body of the response:
(defn handler
[_request]
{:status 200
:body "Hello, world"})
Eval this form (C-x C-e
in Emacs) and refresh http://localhost:8000/ to see
the new response. Loading/compiling the complete namespace does not work yet.