Skip to content

Instantly share code, notes, and snippets.

@chentsulin
Created December 22, 2014 08:33
Show Gist options
  • Save chentsulin/22f1750f7a96ab52f4b2 to your computer and use it in GitHub Desktop.
Save chentsulin/22f1750f7a96ab52f4b2 to your computer and use it in GitHub Desktop.
Simple Http Server in multi programming languages
package server
import(
"net/http"
)
func main() {
http.HandleFunc("/", SayHelloWorld)
http.ListenAndServe(":8080", nil)
}
func SayHelloWorld(rw http.ResponseWriter, r *http.Request) {
rw.Write("Hello World")
}
var http = require('http');
var server = http.createServer(function(req, res) {
res.writeHead(200);
res.end('Hello World');
});
server.listen(8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment