Exemplo n.º 1
0
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)
}
Exemplo n.º 2
0
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)
}
Exemplo n.º 3
0
func main() {
	m := mv.New(UserAgentExtractor{verbose: true})
	http.Handle("/", m.HF(BrowserInfoHandler))
	http.ListenAndServe(":8000", nil)
}