Skip to content

Instantly share code, notes, and snippets.

@fkchang
Created May 30, 2017 17:31
Show Gist options
  • Save fkchang/540d47db9a734acf495c531e39677fa9 to your computer and use it in GitHub Desktop.
Save fkchang/540d47db9a734acf495c531e39677fa9 to your computer and use it in GitHub Desktop.
require 'nodejs'
require 'native'
http = Native(node_require('http'))
port = 1337
http.createServer(lambda { |req, res|
opal_res = Native(res)
opal_res.writeHead(200, { 'Content-Type': 'text/plain' }.to_n)
opal_res.end("Hello World\n")
}).listen(port)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment