import ( "./controller" "net/http" ) var routes = map[string]func(http.ResponseWriter, *http.Request){ "/": controller.Index, "/acct": controller.Acct, "/acct/auth": controller.AcctAuth, // etc... } func ServeHttp(w http.ResponseWriter, r *http.Request) { if handler, ok := routes[r.URL.Path]; ok { handler(w, r) } else { http.Error(w, "Not Found : "+r.URL.Path, 404) return } } func main() { http.ListenAndServe(":80", http.HandlerFunc(ServeHttp)) }