Skip to content

Instantly share code, notes, and snippets.

@meisheep
Forked from janetkuo/web-server.go
Created May 18, 2016 06:33
Show Gist options
  • Save meisheep/2aa3f2f9f16d79a7c583d9a97cdf1d84 to your computer and use it in GitHub Desktop.
Save meisheep/2aa3f2f9f16d79a7c583d9a97cdf1d84 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/http"
)
// hello world, the web server
func HelloServer(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, world!")
}
func main() {
http.HandleFunc("/hello", HelloServer)
http.ListenAndServe(":12345", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment