Skip to content

Instantly share code, notes, and snippets.

@ysasaki
Last active February 25, 2017 07:55
Show Gist options
  • Save ysasaki/42509ab3ef32e85b5a6b586d350f3307 to your computer and use it in GitHub Desktop.
Save ysasaki/42509ab3ef32e85b5a6b586d350f3307 to your computer and use it in GitHub Desktop.
Node.js上のClojureScript REPLのlumoで遊んでみた
(ns request.core)
(def http (js/require "http"))
(defn callback [message]
(let [status-code (.-statusCode message)
headers (-> message .-headers js->clj)]
(do
(println message)
(println (str "statusCode: " status-code))
(println headers))))
(.get http #js {:hostname "www.google.com"
:port 80
:path "/"}
callback)
(ns server.core)
(def http (js/require "http"))
(defn handler [req res]
(do
(println req)
(.end res)))
(def server (.createServer http handler))
(.listen server 8000)
@ysasaki
Copy link
Author

ysasaki commented Feb 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment