diff --git a/README.md b/README.md index bc42c64..a49fe58 100644 --- a/README.md +++ b/README.md @@ -52,22 +52,22 @@ r := sux.New() // Named parameters r.GET("/users/:id", func(w http.ResponseWriter, r *http.Request) { params := sux.ParamsFromContext(r) - id := params["id"] + id := params.Get("id") io.WriteString(w, "User ID: "+id) }) // Wildcard parameters (captures rest of path) r.GET("/files/*path", func(w http.ResponseWriter, r *http.Request) { params := sux.ParamsFromContext(r) - path := params["path"] + path := params.Get("path") io.WriteString(w, "File path: "+path) }) // Multiple parameters r.GET("/users/:userId/posts/:postId", func(w http.ResponseWriter, r *http.Request) { params := sux.ParamsFromContext(r) - userId := params["userId"] - postId := params["postId"] + userId := params.Get("userId") + postId := params.Get("postId") io.WriteString(w, "User "+userId+", Post "+postId) }) ```