Skip to content

Commit c01aa9c

Browse files
committed
0.1.0
1 parent 7a12559 commit c01aa9c

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
11
# mux
22
[![Build Status](https://travis-ci.org/go-http-utils/mux.svg?branch=master)](https://travis-ci.org/go-http-utils/mux)
33
[![Coverage Status](https://coveralls.io/repos/github/go-http-utils/mux/badge.svg?branch=master)](https://coveralls.io/github/go-http-utils/mux?branch=master)
4+
5+
HTTP mux for Go.
6+
7+
## Installation
8+
9+
```
10+
go get -u github.com/go-http-utils/mux
11+
```
12+
13+
## Documentation
14+
15+
API documentation can be found here: https://godoc.org/github.com/go-http-utils/mux
16+
17+
## Usage
18+
19+
```go
20+
import (
21+
"github.com/go-http-utils/mux"
22+
)
23+
```
24+
25+
```go
26+
m := mux.New()
27+
28+
m.Get("/:type(a|b)/:id", mux.HandlerFunc(func(res http.ResponseWriter, req *http.Request, params map[string]string) {
29+
res.WriteHeader(http.StatusOK)
30+
31+
fmt.Println(params["type"])
32+
fmt.Println(params[":id"])
33+
34+
res.Write([]byte("Hello Worlkd"))
35+
}))
36+
37+
http.ListenAndServe(":8080", m)
38+
```

mux.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99
)
1010

1111
// Version is this package's version number.
12-
const Version = "0.0.2"
12+
const Version = "0.1.0"
1313

14-
// Handler responds to a HTTP request.
14+
// Handler likes the http.Handler but with the URL named params support.
1515
type Handler interface {
1616
ServeHTTP(http.ResponseWriter, *http.Request, map[string]string)
1717
}

0 commit comments

Comments
 (0)