diff --git a/4.0/docs/routing/groups.md b/4.0/docs/routing/groups.md index 11c3079f..b266a133 100644 --- a/4.0/docs/routing/groups.md +++ b/4.0/docs/routing/groups.md @@ -11,15 +11,15 @@ Path prefixing route groups allow you to prepend one or more path components to ```swift let users = app.grouped("users") // GET /users -users.get { req -> String in +users.get { req in ... } // POST /users -users.post { req -> String in +users.post { req in ... } // GET /users/:id -users.get(":id") { req -> String in +users.get(":id") { req in let id = req.parameters.get("id")! ... } @@ -30,17 +30,17 @@ Any path component you can pass into methods like `get` or `post` can be passed ```swift app.group("users") { users in // GET /users - users.get { req -> String in - fatalError("...") + users.get { req in + ... } // POST /users - users.post { req -> String in - fatalError("...") + users.post { req in + ... } // GET /users/:id - users.get(":id") { req -> String in + users.get(":id") { req in let id = req.parameters.get("id")! - fatalError("...") + ... } } ``` diff --git a/4.0/docs/routing/overview.md b/4.0/docs/routing/overview.md index 7fdd3417..dce5b885 100644 --- a/4.0/docs/routing/overview.md +++ b/4.0/docs/routing/overview.md @@ -75,10 +75,10 @@ app.get("hello", ":name") { req -> String in By using a path component prefixed with `:`, we indicate to the router that this is a dynamic component. Any string supplied here will now match this route. We can then use `req.parameters` to access the value of the string. -If you run the example request again, you'll still get a response that says hello to vapor. However, you can now include any name after `/hello/` and see it included in the response. Let's try `/hello/bob`. +If you run the example request again, you'll still get a response that says hello to vapor. However, you can now include any name after `/hello/` and see it included in the response. Let's try `/hello/swift`. ```http -GET /hello/bob HTTP/1.1 +GET /hello/swift HTTP/1.1 content-length: 0 ``` ```http @@ -86,7 +86,7 @@ HTTP/1.1 200 OK content-length: 13 content-type: text/plain; charset=utf-8 -Hello, bob! +Hello, swift! ``` Now that you understand the basics, check out each section to learn more about parameters, groups, and more.