Simple HTTP router for Go
Run this command with correctly configured Go toolchain.
go get github.com/ngamux/ngamuxpackage main
import(
"net/http"
"github.com/ngamux/ngamux"
)
func main() {
mux := ngamux.NewNgamux()
mux.Get("/", func(rw http.ResponseWriter, r *http.Request) {
ngamux.JSON(rw, map[string]string{
"message": "welcome!",
})
})
http.ListenAndServe(":8080", mux)
}- Multiple handler (middleware for each route)
- Route group
- Route params (in URL parameters)