Skip to content

Instantly share code, notes, and snippets.

@ihower
Last active October 5, 2015 09:39
Show Gist options
  • Save ihower/e66f664b9f4925fb6754 to your computer and use it in GitHub Desktop.
Save ihower/e66f664b9f4925fb6754 to your computer and use it in GitHub Desktop.
// golang 1.5.1
// go run hello.go
package main
import (
"fmt"
"log"
"net/http"
)
func rootHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello, world!")
}
func main() {
http.HandleFunc("/", rootHandler)
log.Fatal(http.ListenAndServe(":9090", nil))
}
// node 4.1.1
// node hello.js
var ip = "127.0.0.1";
var port = 1337;
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(port, ip);
// ruby 2.2.3, rack 1.6.4, passenger 5.0.20
// passenger start
run Proc.new { |env| ['200', {'Content-Type' => 'text/plain'}, ["Hello World\n"]] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment