https://github.com/go-http-utils/mux
:suspension_railway:HTTP mux for Go
https://github.com/go-http-utils/mux
Last synced: 5 months ago
JSON representation
:suspension_railway:HTTP mux for Go
- Host: GitHub
- URL: https://github.com/go-http-utils/mux
- Owner: go-http-utils
- License: mit
- Created: 2016-12-03T08:22:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-03T16:11:57.000Z (over 9 years ago)
- Last Synced: 2024-06-20T03:38:04.268Z (about 2 years ago)
- Language: Go
- Homepage: https://godoc.org/github.com/go-http-utils/mux
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mux
[](https://travis-ci.org/go-http-utils/mux)
[](https://coveralls.io/github/go-http-utils/mux?branch=master)
HTTP mux for Go.
## Installation
```
go get -u github.com/go-http-utils/mux
```
## Documentation
API documentation can be found here: https://godoc.org/github.com/go-http-utils/mux
## Usage
```go
import (
"github.com/go-http-utils/mux"
)
```
```go
m := mux.New()
m.Get("/:type(a|b)/:id", mux.HandlerFunc(func(res http.ResponseWriter, req *http.Request, params map[string]string) {
res.WriteHeader(http.StatusOK)
fmt.Println(params["type"])
fmt.Println(params[":id"])
res.Write([]byte("Hello Worlkd"))
}))
http.ListenAndServe(":8080", m)
```