Chapter 12.
User model setup and registration
In the upcoming sections of this book, we’re going to shift our focus towards users: registering them, activating them, authenticating them, and restricting access to our API endpoints depending on the permissions that they have.
But before we can do these things, we need to lay some groundwork. Specifically, we need to:
Create a new
userstable in PostgreSQL for storing our user data.Create a
UserModelwhich contains the code for interacting with ouruserstable, validating user data, and hashing user passwords.Develop a
POST /v1/usersendpoint which can be used to register new users in our application.