Skip to content

Instantly share code, notes, and snippets.

@warpfork
Created March 9, 2014 20:33
Show Gist options
  • Save warpfork/9454153 to your computer and use it in GitHub Desktop.
Save warpfork/9454153 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/http"
)
func handler(resp http.ResponseWriter, req *http.Request) {
fmt.Printf("serving \"%s\"\n", req.URL.Path)
http.ServeFile(resp, req, req.URL.Path[1:])
}
func main() {
http.HandleFunc("/", handler)
fmt.Printf("Starting server\n")
http.ListenAndServe(":80", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment