-
-
Save ezra-chu/0e6d53720cf06b86f1119eb2eda03402 to your computer and use it in GitHub Desktop.
Using lumo-cljs to run an Express server
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 server.core | |
(:require | |
[cljs.nodejs :as nodejs])) | |
; Bring in `express` and `http` modules. | |
(defonce express (nodejs/require "express")) | |
(defonce http (nodejs/require "http")) | |
; Create our app. | |
(def app (express)) | |
; Mount GET handler. | |
(. app (get "/hello" | |
(fn [req res] (. res (send "Hello world"))))) | |
; Listen on port 3000. | |
(doto (.createServer http #(app %1 %2)) | |
(.listen 3000)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment