You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
None of the other middleware chaining solutions
behaves exactly like Alice.
Alice is as minimal as it gets:
in essence, it's just a for loop that does the wrapping for you.
Check out this blog post
for explanation how Alice is different from other chaining solutions.
Usage
Your middleware constructors should have the form of
func (http.Handler) http.Handler
Some middleware provide this out of the box.
For ones that don't, it's trivial to write one yourself.
Here, the request will pass throttled first,
then an http.TimeoutHandler we've set up,
then nosurf
and will finally reach our handler.
Note that Alice makes no guarantees for
how one or another piece of middleware will behave.
Once it passes the execution to the outer layer of middleware,
it has no saying in whether middleware will execute the inner handlers.
This is intentional behavior.
Alice works with Go 1.0 and higher.
Contributing
Find an issue that bugs you / open a new one.
Discuss.
Branch off, commit, test.
Make a pull request / attach the commits to the issue.