Skip to content
/ chainer Public

Chain HTTP middleware functions to a http.Handler

License

Notifications You must be signed in to change notification settings

maxwu/chainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chainer

codecov Go Report Card

Assemble HTTP middleware functions to a http.Handler which processes the request in chained middleware order.

Usage

package main
import (
	"net/http"
	"github.com/maxwu/chainer"
)

func main() {
	http.Handle("/", chainer.Chain(
		chainer.MiddlewareFunc(logger),
		chainer.MiddlewareFunc(authenticator),
		chainer.MiddlewareFunc(authorizer),
		chainer.MiddlewareFunc(handler),
	))
	http.ListenAndServe(":8080", nil)
}

References

This project also demonstrates how to use gotest-labels package to select tests by the tags in test case comment block.

About

Chain HTTP middleware functions to a http.Handler

Resources

License

Stars

Watchers

Forks

Packages

No packages published