Skip to content

Commit

Permalink
Merge pull request #4 from fuxiaohei/develop
Browse files Browse the repository at this point in the history
merge develop
  • Loading branch information
fuxiaohei committed Feb 11, 2014
2 parents 0279e65 + 16f653a commit 4af2f7a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 3 additions & 3 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ 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
}

func (rt *Router) Find(url string, method string) (params map[string]string, fn []Handler) {
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 {
Expand Down

0 comments on commit 4af2f7a

Please sign in to comment.