Friday, April 26, 2024
HomeGolangA fantastic set of helper middleware and performance for Golang Chi Library

A fantastic set of helper middleware and performance for Golang Chi Library


chix — helper middleware and performance for go-chi/chi

 Desk of Contents

  • Utilization
  • Options
  • Help & Help
  • Contributing
  • License

Go Library Utilization

go get -u github.com/lrstanley/[email protected]

Golang Library Options

  • http.Server wrapper that simply permits beginning and gracefully shutting down your http server, and different background companies, utilizing errgroup.
  • RealIP middleware (helps whitelisting particular proxies, somewhat than permitting any supply).
  • Rendering helpers:JSON (with ?fairly=true help).
  • Auth middleware:Makes use of markbates/goth to help many alternative suppliers.
  • Encrypts session cookies, which removes the necessity for native session storage.
  • Makes use of Golang 1.18’s generics performance to offer a customized ID and auth object resolver.Now not must kind assert to your native fashions!
  • Optionally requiring authentication.
  • Optionally requiring particular roles.
  • Optionally including authentication information to context to be used by kids handlers.
  • API key validation.
  • API model validation.
  • personal IP middleware, proscribing endpoints to be inner solely.
  • Struct/kind binding, from get/publish information, with help for go-playground/validator.
  • Structured logging utilizing apex/log (identical API as logrus).
    • Permits injecting further metadata into logs.
    • Injects logger into context to be used by kids handlers.
  • Debug middleware:
    • Simply let kids handlers know if world debug flags are enabled.
    • Permits masking errors, except debugging is enabled.
  • Error handler, that routinely handles api-vs-static content material responses.
    • Helps ErrorResolver‘s, offering the power to override standing codes for particular forms of errors.
  • go:embed helpers for mounting an embedded filesystem seamlessly as an http endpoint.
    • Helpful for initiatives that bundle their frontend property of their binary.
    • Helps native filesystem studying, when debugging is enabled (TODO).
  • Middleware for robots.txt and safety.txt responding.

Help & Help

  • heart Please assessment the Code of Conduct for tips on guaranteeing everybody has the perfect expertise interacting with the group.
  • raising_hand_man Check out the help doc on tips for tips about methods to ask the best questions.
  • lady_beetle For all options/bugs/points/questions/and so forth, head over right here.

Contributing to this Golang Library

  • heart Please assessment the Code of Conduct for tips on guaranteeing everybody has the perfect expertise interacting with the group.
  • clipboard Please assessment the contributing doc for submitting points/a information on submitting pull requests and serving to out.
  • old_key For something safety associated, please assessment this repositories safety coverage.

License

MIT License

Copyright (c) 2022 Liam Stanley <[email protected]>

Permission is hereby granted, freed from cost, to any particular person acquiring a duplicate
of this software program and related documentation recordsdata (the "Software program"), to deal
within the Software program with out restriction, together with with out limitation the rights
to make use of, copy, modify, merge, publish, distribute, sublicense, and/or promote
copies of the Software program, and to allow individuals to whom the Software program is
furnished to take action, topic to the next situations:

The above copyright discover and this permission discover shall be included in all
copies or substantial parts of the Software program.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Additionally positioned right here

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments