Created
September 3, 2015 12:15
-
-
Save jamescun/620677003347ae85677b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 main | |
import ( | |
"net/http" | |
) | |
type Handler struct{} | |
func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |
w.Write([]byte("hello world")) | |
} | |
func main() { | |
println("listening on 127.0.0.1:8080") | |
err := http.ListenAndServe("127.0.0.1:8080", Handler{}) | |
if err != nil { | |
panic(err) | |
} | |
} |
This file contains hidden or 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"); | |
function handler(req, res) { | |
res.end("hello world") | |
} | |
var server = http.createServer(handler); | |
server.listen(8080, function() { | |
console.log("listening on 127.0.0.1:8080") | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment