chrisbad.blogg.se

Chr router
Chr router




chr router

Core middlewaresĮnforces a whitelist of request Content-Encoding headersĮxplicit whitelist of accepted request Content-Types

chr router

With net/http can be used with chi's mux. Please note, any middleware in the ecosystem that is also compatible Sprintf( "hi %v, %v", userID, key)))Ĭhi comes equipped with an optional middleware package, providing a suite of standard fetch `"key"` from the request context ctx := r. Set a timeout value on the request context (ctx), that will signal // through ctx.Done() that the request has timed out and further // processing should be stopped. "context" "/go-chi/chi/v5" "/go-chi/chi/v5/middleware" See _examples/ for a variety of examples.

  • No external dependencies - plain ol' Go stdlib + net/http.
  • chr router

  • Go.mod support - as of v5, go.mod support (see CHANGELOG).
  • Doc generation - docgen auto-generates routing documentation from your source to JSON or Markdown.
  • Robust - in production at Pressly, Cloudflare, Heroku, 99Designs, and many others (see discussion).
  • Context control - built on new context package, providing value chaining, cancellations and timeouts.
  • Designed for modular/composable APIs - middlewares, inline middlewares, route groups and sub-router mounting.
  • 100% compatible with net/http - use any http or middleware pkg in the ecosystem that is also compatible with net/http.
  • Lightweight - cloc'd in ~1000 LOC for the chi router.
  • Included some useful/optional subpackages: middleware, renderĪnd docgen. The core router /go-chi/chi is quite small (less than 1000 LOC), but we've also

    chr router

    Handlers (stdlib-only), developer productivity, and deconstructing a large system into many small The key considerations of chi's design are: project structure, maintainability, standard http Public API service, which in turn powers all of our client-side applications. REST API servers, written during the development of the Pressly API service that powers our The focus of the project has been to seek out an elegant and comfortable design for writing Handle signaling, cancelation and request-scoped values across a handler chain. chi is built on the new context package introduced in Go 1.7 to It'sĮspecially good at helping you write large REST API services that are kept maintainable as your Chi is a lightweight, idiomatic and composable router for building Go HTTP services.






    Chr router