update README.md example (#1084)

* update README.md example

* update README.md example


Former-commit-id: 5eb484d2204e839e5408d3b8cf98fa0981d4727a
This commit is contained in:
liguoqinjim 2018-09-16 21:52:11 +08:00 committed by Gerasimos (Makis) Maropoulos
parent 6fc7fc632a
commit f4e2742dc7

View File

@ -223,12 +223,13 @@ func main() {
// This handler will match /users/42
// but will not match
// neither /users or /users/.
app.Get("/users/{id:int64}", func(ctx iris.Context) {
id, _ := ctx.Params().GetUint64("id")
app.Get("/users/{id:long}", func(ctx iris.Context) {
id, _ := ctx.Params().GetInt64("id")
ctx.Writef("User with ID: %d", id)
})
// However, this one will match /user/john/ and also /user/john/send.
// This handler will match /user/john/send
// but will not match /user/john/
app.Post("/user/{name:string}/{action:path}", func(ctx iris.Context) {
name := ctx.Params().Get("name")
action := ctx.Params().Get("action")