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 }
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 }
func startDenco() { mux := denco.NewMux() handler, _ := mux.Build([]denco.Handler{mux.GET("/hello", denco.HandlerFunc(dencoHandler))}) http.ListenAndServe(":"+strconv.Itoa(port), handler) }