Need help with muxchain?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

stephens2424
209 Stars 13 Forks BSD 3-Clause "New" or "Revised" License 32 Commits 1 Opened issues

Description

Lightweight Middleware for net/http

Services available

!
?

Need anything else?

Contributors list

# 126,975
Go
PHP
swagger
openapi...
19 commits
# 141,908
PHP
Shell
HTML
nsq
8 commits
# 38,026
Go
Lua
webrtc
peerjs
1 commit
# 24,382
Go
curl
https-p...
dns-pro...
1 commit

MuxChain

MuxChain is a small package designed to complement net/http for specifying chains of handlers. With it, you can succinctly compose layers of middleware without introducing large dependencies or effectively defeating the type system.

Example

muxchain.Chain("/", logger, gzipHandler, echoHandler)
http.ListenAndServe(":8080", muxchain.Default)

This specifies that all patterns matched should be handled by the logger, then gzip, then echo. Since we're chaining to the default MuxChain, we can just pass that to

http.ListenAndServe
. You can see a more complete example in the "sample" directory.

License

BSD 3-clause (see LICENSE file)

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.