Skip to content

xeptore/middle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Aug 28, 2023
7339d04 · Aug 28, 2023

History

19 Commits
Aug 27, 2023
Aug 28, 2023
Aug 27, 2023
Aug 27, 2023
Aug 25, 2023
Aug 21, 2023
Aug 27, 2023
Aug 25, 2023

Repository files navigation

Middle

Go HTTP middleware I like to use.

Usage

Checkout the examples directory for usage examples.

Compatibility

As this package only depends on net/http package APIs, it can be used in any framework or libraries that uses types exposed by net/http package, e.g., 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 for more.

Using Generator

See gen command line flags, and ./gen.go for an example of usage.