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.…
Author
Released
1/5/2018- 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
Skill Level Intermediate
Duration
Views
-
Introduction
-
Welcome49s
-
-
1. Understanding Server-Side Swift
-
Why server-side Swift?1m 17s
-
Server-side Swift frameworks1m 49s
-
2. Configuring Kitura Project
-
Setting up a Kitura project4m 49s
-
A simple Kitura app3m 38s
-
Returning JSON4m 36s
-
-
3. Reading User Data
-
Reading URL parameters7m 7s
-
Reading JSON6m 34s
-
-
4. PostgreSQL Database Integration
-
5. Integrating Kitura API with the iPhone App
-
Understanding the app2m 14s
-
-
Conclusion
-
Next steps54s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Inserting records into the database