Server-Side Swift with Kitura
Learn how to create Server-Side Swift apps with Kitura. By David Okun.
Part 1: Hello, Kitura
We'll cover what you'll learn in this course, and how you'll walk away from this course with a truly full-stack application.
We'll walk through the finished product and what it should look like, outlining each component of the application and what you'll use to make it.
We'll set up your development environment and make sure you have everything you need to know to write all the code you'll need for this course.
I'll walk you through the basics of HTTP and how it will act as a data transport layer for the basis of this course.
Let's set up Docker on your machine so that you can easily test your Kitura API on Linux and prepare it for deployment.
Learn how to set up your API for deployment with Cloud Foundry via IBM Cloud, and set up your machine to easily push new versions every time you make a change.
I'll walk you through what to expect when you "push the button" to put your API in the Cloud, and how to test it when it's live on the internet!
I'll also walk you through the Kitura CLI, which allows you to generate boilerplate Kitura servers from the command line.
Let's recap everything we've covered and how it positions you to focus on one component at a time as we go through the rest of the course!
Part 2: Completing Your Backend
We'll cover the basics introduced in Kitura 1.0, and then go into some of the finer points of what was added to the Kitura framework in version 2.0, including what a router is and how codable routes work.
Let's make a basic GET route using Kitura, and then let's enhance and streamline that route using the Codable protocol with Kitura's best built in feature - Codable Routing.
Now that you've made two routes in Kitura, you'll make your third one to improve on its functionality.
I'll show you how CouchDB works, and how you'll make use of it to store journal entries that you enter with EmojiJournal.
I'll walk you through setting up CouchDB on your local machine, and how to connect your Kitura server to it.
After I show you how to set up an instance of CouchDB in IBM Cloud, I'll challenge you to connect to it once you have all the information you need to do so.
I'll walk you through writing a series of persistence functions in your Kitura application, so that you have an easy way to keep track of how your app uses CouchDB.
After you write your persistence functions, you'll hook up your codable routes to your database, finally putting all the pieces together.
Take a second to smell the roses and look at what you built! I'll run you through a test drive of your Kitura application.
Part 3: Linking Your iOS Client To Kitura
Learn how KituraKit makes client-side connections to Kitura straightforward, and how it can drastically reduce the amount of code for networking on your client.
Let's walk through what the iOS app does right now, and highlight the pieces you need to get into and make work.
I'll help you set up KituraKit with Cocoapods on your iOS application so that nothing stands in the way of you writing your networking code.
We'll walk through writing a client class for your KituraKit client, so that you have easy functions to use when you are connecting your iOS app to your server.
Now that you've made your client class, I'll help you hook up a couple of the functions to the UI, and let you finish putting the puzzle together yourself.
You can be a full-stack developer! Let's test out your mobile application, and see how well it works with your shiny new Kitura server!
Part 4: Templating A HTML Front-End With Stencil
Learn why it's important to have web functionality for your application and a client thats accessible to everyone, and how Kitura can help you accomplish that.
Learn how Stencil, a templating engine, can help you make any website, and how you can pass info from your Swift API into your HTML page with KituraStencil.
Let's start by serving up a static HTML page using your existing Kitura router, and take some time to explain how you can serve a context with it.
Expand on your previous route by adding some context to your template page, and take a look at how that gets populated throughout your HTML - you'll have a web UI working by the end of this video!
Now that you can see the entries you've populated, let's make it possible to use the web UI to add another entry to your EmojiJournal.
You've got everything you need to know to fit the last puzzle piece into your web UI. I challenge you to add it in and then delete some EmojiJournal entries.
You did it! Let's see how you can use either of your clients at any time to use EmojiJournal, and what you might be interested in trying out next time around!