This course is available as part of the raywenderlich.com Professional subscription. To learn more click here
Pro

Server-Side Swift with Vapor

Apr 5 2022 · Video Course (3 hrs, 21 mins) · Intermediate

In this course you’ll learn everything you need to get start with Vapor, the Server-Side Swift web framework. You’ll cover the basics of routing and sending and receiving data. Next you’ll learn how to use Fluent to save and retrieve information in a database. You’ll see how to leverage Leaf, Vapor’s templating language, to build a web app. You’ll learn how to add authentication to your routes and protect your app. Finally you’ll see how to integrate the Vapor API with an iOS companion app.

Version

  • Swift 5.4, Vapor, Xcode 12 and VSCode

Getting Started With Vapor

Introduction

3:59 Free

In this episode get a brief introduction to the course and see the different things we’ll learn in the next 6 videos.

1

Hello World

7:27 Free

In this episode learn how to install the Vapor toolbox to create your first Vapor project! Learn the very basics of routing to see how to create your own routes.

2

HTTP Basics

4:35 Free

In this episode, learn some of the fundamentals of HTTP that you’ll need to understand for Vapor. We’ll cover requests and responses and look at the different HTTP methods. Finally learn about the different parts of an HTTP message - the head and the body - so we know how to send and receive data.

3

Accepting Data

5:13 Free

In this episode, see how to use Codable to send and receive data with Vapor. Learn how to accept incoming data as JSON and return JSON responses.

4

It’s time to put everything you’ve learned so far into practice and create your own routes as part of a challenge! Create 3 different routes to cover new routes, parameters and sending and receiving JSON.

5

Conclusion

1:04

In the conclusion for part 1 we’ll review everything we’ve covered so far. Then, we’ll see what’s coming up next in Section 2 - exciting!

6

Creating an API

In this episode get a brief introduction to the section and see the different things we’ll learn to work with Fluent and models.

7

Async

8:59

In this episode, take a deep dive into asynchronous programming and see how to work with async code in Vapor.

8

In this episode, learn how to use Fluent to create a model and save it in the database.

9

In this episode, learn how to write controllers to create routes. You’ll also learn about CRUD and how to set up routes and create and retrieve models.

10

In this episode, learn how to write the final routes to finish the CRUD operations - getting a single model, updating a model and deleting a model.

11

It’s time for another challenge! In this episode, put what you’ve learned into practice and create your own models and controlllers.

12

In this episode, learn how to set up a parent-child relationship between two models and then query the relationship.

13

In this episode, learn how to set up a sibling relationship between two models using a pivot table. You’ll then see how to query the relationship with a route.

14

In this episode, learn how to write queries in Fluent to filter on different properties to create a route for searching models.

15

Conclusion

0:54

In this episode we’ll review everythig you’ve learned in this section. Then, we’ll take a look at what’s coming up in the next section.

16

Templating With Leaf

In this episode, get an introduction to this section and see what you’ll learn with Leaf to create a web application in Swift.

17

In this episode, integrate Leaf into your application and set up an HTML page you can view in the browser.

18

In this episode, take your templates to the next level and learn how to dynamically generate HTML to make your web application work with any acronym.

19

In this episode, learn how to embed templates in other templates to avoid duplicating code across pages.

20

In this episode, learn how to use Bootstrap to style your application and make it look amazing. You’ll also learn how to serve static files, like images from Vapor.

21

It’s time for another challenge! In this episode you’ll take what you’ve learned so far to build your own HTML pages for users and categories.

22

In this episode, learn how to create an HTML form to send data to Vapor and use the data to save a new acronym.

23

In this episode, learn how to edit and delete acronyms and see the difference between working with an API and HTML pages.

24

Conclusion

1:13

In this episode we’ll review everythig you’ve learned in this section. Then, we’ll take a look at what’s coming up in the next section.

25

Authentication

In this episode, get an introduction to this section and cover the basics of authentication and using passwords.

26

Passwords

8:03

In this episode, learn about passwords and how to add them to your user model. You’ll also see how to use Bcrypt to properly protect passwords when saving them in the database.

27

In this episode, see how to add authentication to the different API routes. You’ll learn how to use middleware to protect routes and how authenticated users work in Vapor.

28

In this episode, see how to add authentication to the website part of your Vapor app. You’ll learn about sessions and see how authentication is different on the web compared to an API.

29

Conclusion

0:52

In this episode we’ll review everythig you’ve learned in this section. Then, we’ll take a look at what’s coming up in the next section.

30

The iOS App

In this episode, get an introduction to this section and see what parts of the API the iOS app will use.

31

In this episode, learn how to get the iOS app to send requests to display the different models stored in the API.

32

Now that you have added a page in the iOS app to view acronyms, in this episode you’ll learn how to create and delete them. You’ll learn how to add new pages and send requests to the API to perform the actions you want.

33

In this episode, learn how to set up a relationship between acronyms and categories in an iOS app with a great user experience.

34

Conclusion

1:24

In this conclusion video, we’ll review what you have learned in both this section and throughout the course.

35

Version history

Vapor, Swift 5.4, Xcode 12 and VSCode (Selected)

Apr 5 2022

macOS 10.14, Swift 4, Xcode 10

Feb 25 2019

Swift 4, Xcode 9

Feb 13 2018

Who is this for?

Developers comfortable with Swift who want to see how to use Swift on the backend.

Covered concepts

  • Routing
  • Databases
  • Leaf and HTML
  • Authentication

Contributors

Comments