Learn how to insert a new record in the SQLite database.
- [Narrator] Now that we have seen how to get all the dishes…from the PostGres database, using our Kitura server,…the next step would be to add a new dish…to our PostGres database.…For that, we are going to create a new route,…starting with router.post.…This will allow us to post a new dish to the Kitura server.…I'm going to start with a request, response and next.…
We will be sending our data and the new dish…in the form of Json.…So we need to get the parsed body out of the request.…We can access the body using request.body.…If the body is not found, however,…we are simply going to call it next and return.…If the body is found, we are going to perform a switch case…on it, so that we can extract the parsed body…and all the keys associated inside the body.…
We're going to use the Json and then patch in of Json's body,…which, in this case, is the, is represented by jsonBody.…Once we have jsonBody, we can create a complete object…without accessing individual items of the body.…This is by using the dish object and providing the Json.…
- 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