Implementing Sign-Up

Learn how to implement sign-up in NestJS.

Having successfully set up all the essential user and authentication (auth) files, we’re ready to delve deeper. In this lesson, we will learn the sign-up process, ensuring users experience a seamless registration for our virtual library.

Press + to interact
Sign-up form
Sign-up form

Defining SignUpDto

To register in our virtual library, users will need two essential pieces of information: email and password. To maintain the integrity of our system, we must ensure users provide both fields during the registration process.

Here are the requirements:

  • The value provided for email should be a valid email address.

  • The password should have a minimum length of 8 characters and a maximum length of 32 characters.

Based on these requirements, try to complete the SignUpDto:

Defining SignUpDto

Defining the signUp method in AuthService

The next step is to define the signUp method responsible for registration logic in AuthService.

Defining the signUp method in AuthService

Within the signUp method, we extract the email and password from SignUpDto and use the save method of ...