From the course: Using Vapor with SQL and NoSQL Databases
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Creating a login controller - Swift Tutorial
From the course: Using Vapor with SQL and NoSQL Databases
Creating a login controller
- [Instructor] After creating our user model and the handling of credentials that will pass for authentication, it's time for us to create login mechanisms so that we can handle user registration and login. So the first thing that I want to do is create a new file. So I'm going to come over here to my terminal in my project window and create a new file called Login Controller. Once I make that file, I'm going to go ahead and re-generate my Xcode project. And then once my Xcode project refreshes, I'm going to jump right into that controller. In here the first thing I want to do is import a few modules. So I want to do import Vapor, import HTTP. We're also going to import Turnstile and TurnstileCrypto. So we need to create different functions here. The LoginController is going to be able to handle our user registration. It's going to be able to handle login and we also have to display some views. So let's start with registration. I'm going to create a function called register. With this…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.