Skip to content

Repository files navigation

dispatch

GoDocBuild Statuscodecov

dispatch is HTTP request multiplexer compatible with ServeMux of net/http.

Dependencies

  • Go 1.7 or lator

No dependency on the third party library.

Installation

go get -u github.com/i2bskn/dispatch

Usage

package main
import (
"fmt""log""net/http""github.com/i2bskn/dispatch"
)
funchello(w http.ResponseWriter, r*http.Request) {
fmt.Fprintf(w, "Hello %s!", dispatch.Param(r, "name"))
}
funcmain() {
mux:=dispatch.New()
mux.HandleFunc("/hello/:name", hello)
mux.HandleFunc("/", func(w http.ResponseWriter, r*http.Request) {
fmt.Fprint(w, "Home!")
})
log.Fatal(http.ListenAndServe(":8080", mux))
}

See also GoDoc.

License

dispatch is available under the MIT.

About

HTTP request multiplexer

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages