Merge pull request #51 from zhao95/patch-1

Program syntax error
This commit is contained in:
Tanner 2016-10-03 15:06:20 -04:00 committed by GitHub
commit fc62ddbba8
1 changed files with 5 additions and 6 deletions

View File

@ -11,12 +11,11 @@ JSON is an integral part of Vapor. It powers Vapor's [Config](config.md) and is
JSON is automatically available in `request.data` alongside form-urlencoded data and query data. This allows you to focus on making a great API, not worrying about what content types data will be sent in.
```swift
drop.any("hello") { request in
guard let name = request.data["name"].string else {
throw Abort.badRequest
}
return "Hello, \(name)!"
drop.get("hello") { request in
guard let name = request.data["name"]?.string else {
throw Abort.badRequest
}
return "Hello, \(name)!"
}
```