Created
December 22, 2014 08:33
-
-
Save chentsulin/22f1750f7a96ab52f4b2 to your computer and use it in GitHub Desktop.
Simple Http Server in multi programming languages
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
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") | |
} |
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
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