コード例 #1
0
func loadDencoSingle(method, path string, handle denco.HandlerFunc) http.Handler {
	mux := denco.NewMux()
	handler, err := mux.Build([]denco.Handler{{method, path, handle}})
	if err != nil {
		panic(err)
	}
	return handler
}
コード例 #2
0
func loadDenco(routes []route) http.Handler {
	mux := denco.NewMux()
	handlers := make([]denco.Handler, len(routes))
	for i, route := range routes {
		handlers[i] = mux.Handler(route.method, route.path, dencoHandle)
	}
	handler, err := mux.Build(handlers)
	if err != nil {
		panic(err)
	}
	return handler
}
コード例 #3
0
func startDenco() {
	mux := denco.NewMux()
	handler, _ := mux.Build([]denco.Handler{mux.GET("/hello", denco.HandlerFunc(dencoHandler))})
	http.ListenAndServe(":"+strconv.Itoa(port), handler)
}