Getting started with the User model

Great! Now that we have AuthProvider added to the project, we can build and run our app to confirm we have imported it correctly. Now, let's go ahead and define our User model next:

  1. Create a new file called User.swift inside the Models folder in your Vapor app and make sure that you check App under Targets:
  1. Inside this file, delete all of the sample code and import the following dependencies:
import FluentProviderimport HTTPimport Fluentimport AuthProvider
  1. Next, define the class, and we will make it implement both the Model and SessionPersistable protocols:
final class User: Model, SessionPersistable ...

Get Hands-On Full-Stack Development with Swift now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.