Sign-up Implementation
Let’s apply what we’ve learned about the signup process, and learn how to test an API.
We'll cover the following...
We’ll start implementing the sign-up functionality and all of its logic, which includes the following:
-
Encrypting the password.
-
Validating the data.
-
Updating the database with the new user.
-
Creating the JWT token for that user.
Let’s move directly to the implementation details:
-
Navigate to the
controllers
directory and make a new file nameduser.js
.cd controllers touch user.js
-
Install the
bcrypt
andjsonwebtoken
packages.-
The
bcrypt
package helps encrypt the user password before storing it in the database. -
The
jsonwebtoken
package allows us to generate a ...
-