jashkenas--coffeescript/examples/web_server.coffee

14 lines
282 B
CoffeeScript
Raw Normal View History

2010-02-14 23:20:53 -05:00
# Contributed by Jason Huggins
2010-07-29 00:17:48 -04:00
sys = require 'sys'
http = require 'http'
2010-02-14 23:20:53 -05:00
2010-07-29 00:17:48 -04:00
server = http.createServer (req, res) ->
res.writeHeader 200, 'Content-Type': 'text/plain'
res.write 'Hello, World!'
res.end()
2010-02-14 23:20:53 -05:00
server.listen 3000
sys.puts "Server running at http://localhost:3000/"