This is a code along for MERN Auth
Notes:
- Set up server
- Test home route
- Make api folder and test /test route
- Set up models
- Setup passport strategy
- Intialize passport and pass passport as arguemnt to config
- Make controllers for user
- Test each one after completing it.
- /test, /register, /login, /profile
- Make route for each controller
- Test other controllers in the box
- Make template, add models and routes
- Mongoose User schema and model
- Settings for the database
- Passport and passport-jwt for authentication
- JSON Web Token
- Passwords that are hashed with BCrypt
Column Name | Data Type | Notes |
---|---|---|
id | Integer | Serial Primary Key, Auto-generated |
name | String | Must be provided |
String | Must be unique / used for login | |
password | String | Stored as a hash |
timesLoggedIn | Number | used to track the amount of times a user logs in |
date | Date | Auto-generated |
__v | Number | Auto-generated |
Method | Path | Location | Purpose |
---|---|---|---|
GET | / | app.js | Server file |
GET | /api/users/test | users.js | Return json data |
POST | /api/users/login | users.js | Login data |
POST | /api/users/signup | users.js | Signup data |
GET | /api/users/profile | users.js | Profile data |
GET | /api/users/all-users | users.js | Get all users |