April 2017
Intermediate to advanced
316 pages
9h 33m
English
Every route call gets passed a request object that can be used to grab query and path parameters.
The following example shows how to access JSON, Query, and form-encoded data from the request:
drop.post("hello") { request in guard let name = request.data["name"]?.string else { return "Please include a name" } return "Hello, \(name)!" }
In this example, we read the request data and return a string.
Vapor also provides the means for session management, database connection, and view responses with HTML or Stencil template-included HTML pages. There is an example Vapor project (https://github.com/qutheory/vapor-example) that can be used and modified for our purposes. We are not going to explore Vapor in depth since it is still ...
Read now
Unlock full access