Beispiel #1
0
func petAPIRouterBuilder(spec *spec.Document, api *untyped.API) *defaultRouteBuilder {
	builder := newDefaultRouteBuilder(spec, newRoutableUntypedAPI(spec, api, new(Context)))
	builder.AddRoute("GET", "/pets", spec.AllPaths()["/pets"].Get)
	builder.AddRoute("POST", "/pets", spec.AllPaths()["/pets"].Post)
	builder.AddRoute("DELETE", "/pets/{id}", spec.AllPaths()["/pets/{id}"].Delete)
	builder.AddRoute("GET", "/pets/{id}", spec.AllPaths()["/pets/{id}"].Get)

	return builder
}