To add Registration and Login web pages is as simple as setting up a route in our Routes.swift and creating a Leaf template file that will render the HTML forms. For our Leaf template, we will need to create a signup form for the new user and a login form for users that have registered already. To get started with adding these forms to our Vapor app, we need to follow these steps:
- First, open the Routes.swift file and remove everything inside the setupRoutes method as we will be setting up two kinds of routes, one for authenticated users and another for unauthenticated.
- Next, import the AuthProvider and Sessions dependencies that we will need later by adding the following two lines to the top of the file: