Skip to content

Instantly share code, notes, and snippets.

@will3942
Last active December 30, 2015 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save will3942/7793213 to your computer and use it in GitHub Desktop.
Save will3942/7793213 to your computer and use it in GitHub Desktop.
Go: Web Server
package main
import (
"fmt"
"net/http"
)
func handlerequest(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hi you accessed post %s", r.URL.Path[1:])
}
func main() {
http.HandleFunc("/", handlerequest)
http.ListenAndServe(":8000", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment