Created
April 16, 2010 14:23
-
-
Save tangzero/368460 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env coffee | |
sys: require 'sys' | |
http: require 'http' | |
server: http.createServer (req, res) -> | |
res.writeHeader 200, {'Content-Type': 'text/plain'} | |
res.write 'Hello, World!' | |
res.end() | |
server.listen 8080 | |
sys.puts "Server running at http://localhost:8080/" |
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
#!/usr/bin/env node | |
(function (port) { | |
/* Some useful modules for future programs. */ | |
var sys = require('sys'), /* system access, e.g. standard I/O */ | |
http = require('http'); /* Yippee, a web server object, really nice. */ | |
/* Create the web server */ | |
http.createServer(function (request, response) { | |
/* Build our page with sendHeader(), sendBody() and send the page with finish() */ | |
response.sendHeader('Content-Type: text/plain'); | |
response.write('Hello World'); | |
response.close(); | |
}).listen(port); | |
/* Display a console message */ | |
sys.puts("Running on port:" + port + " with process id: " + process.pid); | |
})(8080); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment