Skip to content

A "hello, world" HTTP server example running ClojureScript on Deno

License

Notifications You must be signed in to change notification settings

maxweber/cljs-deno-example

 
 

Repository files navigation

ClojureScript Deno example + shadow-cljs REPL

A "Hello, world" HTTP server example running ClojureScript on Deno.

Running

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.

About

A "hello, world" HTTP server example running ClojureScript on Deno

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Clojure 78.5%
  • JavaScript 21.5%