Join Emmanuel Henri to create the user models that will be used to authenticate users. Learn about installing the dependencies required for the new project.
- [Instructor] The next step in building a secured API … is to add users that can register … and log into the application. … And for that to happen, we need a user schema. … So let's get back to VS Code, … and in the models folder, I'll create a few file. … So I'm going to go ahead and click new file here, … and then call this … user … model … dot JS. … And if you created that file outside of the folder here, … all you have to do is drag and drop that file … inside of the folder, and then yes, move it, … and then the file's going to be in the right folder. … So let's go ahead and start by importing mongoose … from mongoose. … And then, let's go ahead and create a variable … that we'll call schema. … And that looks very similar to this CR model here. … So if you don't want to waste cycles … in typing all these extra stuff, … what you can do is copy and paste that section here, … like so, and then bring it back to … the model here. … So you have the first line that we need, … and then instead of contact schema, …
- Open Web Application Security Project (OWASP)
- Reasons for using a JSON Web Token (JWT)
- Adding bcrypt password hashing
- Adding handlers for registration and login
- Finalizing secured endpoints
- Testing APIs with Postman