diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/README.md b/README.md index ea50562..8aab966 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,26 @@ or: The attribute Validations is optional, but all the keys defined in the map need to be parameters in the URL. +If you use validation, you can write this kind of route with no ambiguity: + + &Route{ + Method: "GET", + Path: "/user/:id", + Code: GetUserById, + Validations: map[string]*regexp.Regexp{ + "id": regexp.MustCompile("[\\d]+"), + } + } + + &Route{ + Method: "GET", + Path: "/user/:name", + Code: GetUserByName, + Validations: map[string]*regexp.Regexp{ + "id": regexp.MustCompile("[a-zA-Z]+"), + } + } + ## External links * [Build status](https://drone.io/github.com/franckcuny/mooh/latest) |