Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bmizerany/pat
https://github.com/bmizerany/pat
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/bmizerany/pat
- Owner: bmizerany
- License: mit
- Created: 2012-01-25T23:37:07.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2022-06-28T12:19:41.000Z (almost 2 years ago)
- Last Synced: 2024-02-15T02:35:03.485Z (4 months ago)
- Language: Go
- Size: 981 KB
- Stars: 1,416
- Watchers: 37
- Forks: 122
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-go-zh - pat
- awesome-go - pat - Sinatra style pattern muxer for Go's net/http library, formerly pat.go (Multiplexers)
- fucking-awesome-go - :octocat: pat - Sinatra style pattern muxer for Go’s net/http library, by the author of Sinatra. :star: 953 :fork_and_knife: 96 (Web Frameworks / Advanced Console UIs)
- awesome-stars - pat
- awesome-go. - pat - Sinatra style pattern muxer for Go’s net/http library, by the author of Sinatra. (Web Frameworks / Routers)
- awesome-go - pat - Sinatra style pattern muxer for Go’s net/http library, by the author of Sinatra. (Web Frameworks / Advanced Console UIs)
- awesome-go - pat - Sinatra style pattern muxer for Go’s net/http library, by the author of Sinatra. (Web Frameworks / Routers)
- awesome-go-cn - pat - Sinatra 风格的模式 muxer ,用于go语言 net/http库,由 Sinatra的作者编写。 (XML / 路由)
- awesome-go-cn - pat
- awesome-go - pat - Sinatra style pattern muxer for Go’s net/http library, by the author of Sinatra. (Web Frameworks / Routers)
- awesome-go - pat - Sinatra style pattern muxer for Go’s net/http library, by the author of Sinatra. (XML / Routers)
- awesome-from-stars - bmizerany/pat
- awesome-go - pat - Sinatra 風格的模式 muxer ,用於go語言 net/http庫,由 Sinatra的作者編寫。 (XML / 路由)
- awesome-go - pat - ★ 1149 (Web Frameworks)
- awesome-go2 - pat - Sinatra style pattern muxer for Go’s net/http library, by the author of Sinatra. (Web Frameworks / Routers)
- awesome-cobol - pat - Sinatra style pattern muxer for Cobol’s net/http library, by the author of Sinatra. (Web Frameworks)
- awesome-go - pat - Sinatra style pattern muxer for Go’s net/http library, by the author of Sinatra. (Web Frameworks / Advanced Console UIs)
- awesome-go - pat - Sinatra style pattern muxer for Go’s net/http library, by the author of Sinatra. (Web Frameworks / Advanced Console UIs)
README
# pat (formerly pat.go) - A Sinatra style pattern muxer for Go's net/http library
[![GoDoc](https://godoc.org/github.com/bmizerany/pat?status.svg)](https://godoc.org/github.com/bmizerany/pat)
## INSTALL
$ go get github.com/bmizerany/pat
## USE
```go
package mainimport (
"io"
"net/http"
"github.com/bmizerany/pat"
"log"
)// hello world, the web server
func HelloServer(w http.ResponseWriter, req *http.Request) {
io.WriteString(w, "hello, "+req.URL.Query().Get(":name")+"!\n")
}func main() {
m := pat.New()
m.Get("/hello/:name", http.HandlerFunc(HelloServer))// Register this pat with the default serve mux so that other packages
// may also be exported. (i.e. /debug/pprof/*)
http.Handle("/", m)
err := http.ListenAndServe(":12345", nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}
```It's that simple.
For more information, see:
http://godoc.org/github.com/bmizerany/pat## CONTRIBUTORS
* Alexis Svinartchouk (@zvin)
* Blake Mizerany (@bmizerany)
* Brian Ketelsen (@bketelsen)
* Bryan Matsuo (@bmatsuo)
* Caleb Spare (@cespare)
* Evan Shaw (@edsrzf)
* Gary Burd (@garyburd)
* George Rogers (@georgerogers42)
* Keith Rarick (@kr)
* Matt Williams (@mattyw)
* Mike Stipicevic (@wickedchicken)
* Nick Saika (@nesv)
* Timothy Cyrus (@tcyrus)
* binqin (@binku87)## LICENSE
Copyright (C) 2012 by Keith Rarick, Blake Mizerany
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.