Learn how to return using Kitura framework as well as how to convert your model classes into a compatible JSON format.
- [Narrator] Sending text back is great,…but most of the communication to a web API…is performed over either XML or JSON format.…JSON stands for, "Java Script Object Notation."…It is one of the most common ways for passing information…between the client and the server.…Let's create a get request which returns…the first name and the last name of a customer.…We will start by creating a get request…using the router instance of the Kitura framework.…
And we will point it to a customer route,…represented by simply, "customer."…We are going to add the request response…and the next parameters, we are going…to provide the three parameters which are required…by the router.get function, which are,…"request," "response," and, "next."…Now instead of sending back text, we can simply return…JSON format by passing back a dictionary.…
This can be done by simply using response.send…and one of the overloads of response.send, which uses JSON.…In the dictionary, we are going to provide…the key value pairs, so, "firstName,"…and we can provide a value for the first name,…
- Reviewing the concepts behind server-side Swift programming
- Different server-side Swift frameworks
- Setting up a Kitura project
- Adding HeliumLogger for debugging
- Accessing JSON passed parameters using Kitura.
- Reading URL parameters and URL encoded form parameters
- Configuring the PostgreSQL database
- Fetching, inserting, and deleting records from the database
- Integrating a Kitura API with an iPhone app