Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xeptore/middle

Go HTTP middleware I like to use
https://github.com/xeptore/middle

go-generics go-generics-middleware go-http-middleware go-http-middleware-generic go-middleware go-middleware-generic go-typed-http-middleware go-typed-middleware golang-http-middleware golang-http-middleware-generic golang-middleware golang-middleware-generic golang-typed-http-middleware golang-typed-middleware http-middleware http-middleware-generic middleware middleware-generic typed-http-middleware typed-middleware

Last synced: about 2 months ago
JSON representation

Go HTTP middleware I like to use

Awesome Lists containing this project

README

        

# Middle

Go HTTP middleware I like to use.

## Usage

Checkout the [examples](./examples/) directory for usage examples.

## Compatibility

As this package only depends on [`net/http`](https://pkg.go.dev/net/http) package APIs, it can be used in any framework or libraries that uses types exposed by [`net/http`](https://pkg.go.dev/net/http) package, e.g., [`github.com/julienschmidt/httprouter`](https://github.com/julienschmidt/httprouter).

## Limitations

This package exposes middleware functions chain builders for up to 27 functions, i.e., `Chain1` up to `Chain27`. Although I think this is way more than enough for most of applications, I plan to improve the generator so you can generate your `middle.ChainN` up to any number of `N` you need by using it. See [generator](#using-generator) for more.

## Using Generator

See [`gen`](./gen/gen.go) command line flags, and [`./gen.go`](./gen.go) for an example of usage.