Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stephens2424/muxchain
Lightweight Middleware for net/http
https://github.com/stephens2424/muxchain
Last synced: 25 days ago
JSON representation
Lightweight Middleware for net/http
- Host: GitHub
- URL: https://github.com/stephens2424/muxchain
- Owner: stephens2424
- License: bsd-3-clause
- Created: 2014-05-03T17:14:17.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-03-19T21:44:51.000Z (over 5 years ago)
- Last Synced: 2024-08-03T15:06:14.318Z (4 months ago)
- Language: Go
- Homepage:
- Size: 24.4 KB
- Stars: 208
- Watchers: 7
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cobol - muxchain - Lightweight middleware for net/http (Web Frameworks / Middlewares)
- awesome-go - muxchain - Lightweight Middleware for net/http - ★ 203 (Web Frameworks)
- awesome-go-extra - muxchain - 05-03T17:14:17Z|2019-03-19T21:44:51Z| (Web Frameworks / Fail injection)
README
# MuxChain
MuxChain is a small package designed to complement [net/http](http://golang.org/pkg/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)