Chix -- helper middleware and functionality for go-chi/chi

Overview

chix -- helper middleware and functionality for go-chi/chi

🔗 Table of Contents

⚙️ Usage

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

✨ Features

  • http.Server wrapper that easily allows starting, and gracefully shutting down your http server, and other background services, using errgroup.
  • RealIP middleware (supports whitelisting specific proxies, rather than allowing any source).
  • private IP middleware, restricting endpoints to be internal only.
  • Rendering helpers:
    • JSON (with ?pretty=true support).
  • Auth middleware:
    • Uses markbates/goth to support many different providers.
    • Encrypts session cookies, which removes the need for local session storage.
    • Uses Go 1.18's generics functionality to provide a custom ID and auth object resolver.
      • No longer have to type assert to your local models!
    • Optionally requiring authentication.
    • Optionally requiring specific roles.
    • Optionally adding authentication info to context for use by children handlers.
    • API key validation.
    • API version validation.
  • Struct/type binding, from get/post data, with support for go-playground/validator.
  • Structured logging using apex/log (same API as logrus).
    • Allows injecting additional metadata into logs.
    • Injects logger into context for use by children handlers.
  • Debug middleware:
    • Easily let children handlers know if global debug flags are enabled.
    • Allows masking errors, unless debugging is enabled.
  • Error handler, that automatically handles api-vs-static content responses.
    • Supports ErrorResolver's, providing the ability to override status codes for specific types of errors.
  • go:embed helpers for mounting an embedded filesystem seamlessly as an http endpoint.
    • Useful for projects that bundle their frontend assets in their binary.
    • Supports local filesystem reading, when debugging is enabled (TODO).
  • Middleware for robots.txt and security.txt responding.

🙋‍♂️ Support & Assistance

  • ❤️ Please review the Code of Conduct for guidelines on ensuring everyone has the best experience interacting with the community.
  • 🙋‍♂️ Take a look at the support document on guidelines for tips on how to ask the right questions.
  • 🐞 For all features/bugs/issues/questions/etc, head over here.

🤝 Contributing

  • ❤️ Please review the Code of Conduct for guidelines on ensuring everyone has the best experience interacting with the community.
  • 📋 Please review the contributing doc for submitting issues/a guide on submitting pull requests and helping out.
  • 🗝️ For anything security related, please review this repositories security policy.

⚖️ License

MIT License

Copyright (c) 2022 Liam Stanley 

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

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.

Also located here

Issues
  • chore(deps): bump github.com/markbates/goth from 1.71.1 to 1.72.0

    chore(deps): bump github.com/markbates/goth from 1.71.1 to 1.72.0

    Bumps github.com/markbates/goth from 1.71.1 to 1.72.0.

    Release notes

    Sourced from github.com/markbates/goth's releases.

    v1.72.0

    What's Changed

    New Contributors

    Full Changelog: https://github.com/markbates/goth/compare/v1.71.1...v1.72.0

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies go 
    opened by dependabot[bot] 0
Owner
Liam Stanley
Avid, enthusiastic, computer programming & operations nerd.
Liam Stanley
This package provides Go (golang) types and helper functions to do some basic but useful things with mxGraph diagrams in XML, which is most famously used by app.diagrams.net, the new name of draw.io.

Go Draw - Golang MX This package provides types and helper functions to do some basic but useful things with mxGraph diagrams in XML, which is most fa

null 1 Nov 30, 2021
Package i18n is a middleware that provides internationalization and localization for Flamego

i18n Package i18n is a middleware that provides internationalization and localization for Flamego. Installation The minimum requirement of Go is 1.16.

Flamego 5 Dec 15, 2021
Decode / encode XML to/from map[string]interface{} (or JSON); extract values with dot-notation paths and wildcards. Replaces x2j and j2x packages.

mxj - to/from maps, XML and JSON Decode/encode XML to/from map[string]interface{} (or JSON) values, and extract/modify values from maps by key or key-

Charles Banning 516 May 3, 2022
Pagser is a simple, extensible, configurable parse and deserialize html page to struct based on goquery and struct tags for golang crawler

Pagser Pagser inspired by page parser。 Pagser is a simple, extensible, configurable parse and deserialize html page to struct based on goquery and str

foolin 60 May 8, 2022
[Go] Package of validators and sanitizers for strings, numerics, slices and structs

govalidator A package of validators and sanitizers for strings, structs and collections. Based on validator.js. Installation Make sure that Go is inst

Alex Saskevich 5.4k May 11, 2022
Take screenshots of websites and create PDF from HTML pages using chromium and docker

gochro is a small docker image with chromium installed and a golang based webserver to interact wit it. It can be used to take screenshots of w

Christian Mehlmauer 48 Apr 19, 2022
Parse data and test fixtures from markdown files, and patch them programmatically, too.

go-testmark Do you need test fixtures and example data for your project, in a language agnostic way? Do you want it to be easy to combine with documen

Eric Myhre 10 Nov 10, 2021
Watches container registries for new and changed tags and creates an RSS feed for detected changes.

Tagwatch Watches container registries for new and changed tags and creates an RSS feed for detected changes. Configuration Tagwatch is configured thro

Wolfgang Popp 1 Jan 7, 2022
A general purpose application and library for aligning text.

align A general purpose application that aligns text The focus of this application is to provide a fast, efficient, and useful tool for aligning text.

John Moore 75 Mar 24, 2022
Parse placeholder and wildcard text commands

allot allot is a small Golang library to match and parse commands with pre-defined strings. For example use allot to define a list of commands your CL

Sebastian Müller 55 Apr 13, 2022
:evergreen_tree: Parses indented code and returns a tree structure.

codetree Parses indented code (Python, Pug, Stylus, Pixy, codetree, etc.) and returns a tree structure. Installation go get github.com/aerogo/codetree

Aero 20 Mar 6, 2022
Elegant Scraper and Crawler Framework for Golang

Colly Lightning Fast and Elegant Scraping Framework for Gophers Colly provides a clean interface to write any kind of crawler/scraper/spider. With Col

Colly 16.6k May 19, 2022
Encoding and decoding for fixed-width formatted data

fixedwidth Package fixedwidth provides encoding and decoding for fixed-width formatted Data. go get github.com/ianlopshire/go-fixedwidth Usage Struct

Ian Lopshire 63 May 8, 2022
A Go library to parse and format vCard

go-vcard A Go library to parse and format vCard. Usage f, err := os.Open("cards.vcf") if err != nil { log.Fatal(err) } defer f.Close() dec := vcard.

Simon Ser 69 May 7, 2022
Zero-width character detection and removal for Go

go-zero-width Zero-width character detection and removal for Go. Inspired by this Medium article. Installation go get github.com/trubitsyn/go-zero-wid

Nikola Trubitsyn 101 Apr 21, 2022
Parse RSS, Atom and JSON feeds in Go

gofeed The gofeed library is a robust feed parser that supports parsing both RSS, Atom and JSON feeds. The library provides a universal gofeed.Parser

null 1.9k May 18, 2022
Takes a full name and splits it into individual name parts

gonameparts gonameparts splits a human name into individual parts. This is useful when dealing with external data sources that provide names as a sing

James Polera 35 Apr 7, 2022
⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.

html-to-markdown Convert HTML into Markdown with Go. It is using an HTML Parser to avoid the use of regexp as much as possible. That should prevent so

Johannes Kaufmann 356 May 16, 2022
omniparser: a native Golang ETL streaming parser and transform library for CSV, JSON, XML, EDI, text, etc.

omniparser Omniparser is a native Golang ETL parser that ingests input data of various formats (CSV, txt, fixed length/width, XML, EDI/X12/EDIFACT, JS

JF Technology 451 May 10, 2022