diff --git a/README.md b/README.md index 3c53b04..aaea1ae 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,25 @@ # GoInk -very simple go web framework. +Very simple go web framework. + +[![Build Status](https://drone.io/github.com/fuxiaohei/GoInk/status.png)](https://drone.io/github.com/fuxiaohei/GoInk/latest) +[![GoWalker](https://gowalker.org/api/v1/badge)](https://gowalker.org/github.com/fuxiaohei/GoInk) + +Current version **0.5-stable**. ### Sample -* simple usage: [link](https://github.com/fuxiaohei/GoInk/blob/master/sample/simple/main.go) +* Simple application: [link](https://github.com/fuxiaohei/GoInk/blob/master/sample/simple/main.go) ### Wiki -writing +Visit github [wiki](https://github.com/fuxiaohei/GoInk/wiki): + +1. [Getting Started](https://github.com/fuxiaohei/GoInk/wiki/1.-Getting-Started) +2. [Context, Routing and Middleware](https://github.com/fuxiaohei/GoInk/wiki/2.-Context,-Routing-and-Middleware) +3. [Input, Request and Response](https://github.com/fuxiaohei/GoInk/wiki/3.-Input,-Request-and-Response) +4. [View, Event and Flash Data](https://github.com/fuxiaohei/GoInk/wiki/4.-View,-Event-and-Flash-Data) +5. [Configuration](https://github.com/fuxiaohei/GoInk/wiki/5.-Configuration) ### License diff --git a/router.go b/router.go index 9813575..19f895a 100644 --- a/router.go +++ b/router.go @@ -70,7 +70,7 @@ func (rt *Router) parsePattern(pattern string) (regex *regexp.Regexp, params []s params = append(params, strings.TrimPrefix(v, ":")) } } - regex, _ = regexp.Compile("^"+strings.Join(segments, "/")+"$") + regex, _ = regexp.Compile("^" + strings.Join(segments, "/") + "$") return } @@ -78,8 +78,8 @@ func (rt *Router) Find(url string, method string) (params map[string]string, fn sfx := path.Ext(url) url = strings.Replace(url, sfx, "", -1) // fix path end slash - if !strings.HasSuffix(url,"/") && sfx == ""{ - url +="/" + if !strings.HasSuffix(url, "/") && sfx == "" { + url += "/" } for _, r := range rt.routeSlice { if r.regex.MatchString(url) && r.method == method {