func main() { m := mv.New() m.UseFunc(Middleware1, Middleware2) http.Handle("/hello", m.HF(HelloHandler)) http.Handle("/workd", m.HF(WorldHandler)) http.ListenAndServe(":8000", nil) }
func main() { m := mv.New(mv.HandlerFunc(LoggingMiddleware)) // all calls go through logging middleware authOnly := m.Fork(mv.HandlerFunc(AuthMiddleware)) http.Handle("/public", m.HF(PubliclyAvailable)) http.Handle("/auth", authOnly.HF(PrivatelyAvailable)) http.ListenAndServe(":8000", nil) }
func main() { m := mv.New(UserAgentExtractor{verbose: true}) http.Handle("/", m.HF(BrowserInfoHandler)) http.ListenAndServe(":8000", nil) }