Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/xeptore/middle
- Owner: xeptore
- License: mit
- Created: 2023-08-21T10:38:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-28T03:08:08.000Z (over 1 year ago)
- Last Synced: 2024-06-21T16:57:07.505Z (7 months ago)
- Topics: 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
- Language: Go
- Homepage: https://pkg.go.dev/github.com/xeptore/middle/v6
- Size: 72.3 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
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.