Skip to content

Instantly share code, notes, and snippets.

@tangzero
Created April 16, 2010 14:23
Show Gist options
  • Save tangzero/368460 to your computer and use it in GitHub Desktop.
Save tangzero/368460 to your computer and use it in GitHub Desktop.
#!/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/"
#!/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