Last active
February 25, 2017 07:55
-
-
Save ysasaki/42509ab3ef32e85b5a6b586d350f3307 to your computer and use it in GitHub Desktop.
Node.js上のClojureScript REPLのlumoで遊んでみた
This file contains hidden or 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 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) |
This file contains hidden or 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) | |
(def http (js/require "http")) | |
(defn handler [req res] | |
(do | |
(println req) | |
(.end res))) | |
(def server (.createServer http handler)) | |
(.listen server 8000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lumo https://github.com/anmonteiro/lumo