This project is a Contact Management App built with Express.js and MongoDB., creating an Express server, handling routes, and performing CRUD operations for contacts and users.
- Introduction
- Project Setup
- Creating an Express Server
- Setting Up Thunder Client
- Express Router & Contacts CRUD Routes
- Contact Controller for CRUD Operations
- Handling HTTP Methods
- Middleware for POST Requests
- Error Handling
- Async Handler
- MongoDB Setup
- Connecting Express to MongoDB
- Mongoose Schema for Contacts
- CRUD Operations for Contacts
- User Routes
- User Controller
- Mongoose Schema for User
- User Registration and Password Hashing
- JWT Access Token and User Login
- Protecting Routes
- User and Contact Relationship
- Outro
Overview of the project and REST API conventions.
Setting up the project structure for the Contact Management App.
Creating an Express server for handling requests.
Setting up Thunder Client for testing the API.
Setting up Express Router and CRUD routes for contacts.
Creating a Contact Controller to handle CRUD operations.
Handling multiple HTTP methods per route.
Using built-in middleware to handle POST request bodies.
Throwing and handling errors using middleware.
Using an async handler for asynchronous operations.
Setting up MongoDB for the project.
Connecting the Express app to the MongoDB database.
Creating a Mongoose schema for contacts.
Implementing the GET all contacts operation.
Implementing the POST create new contact operation.
Implementing the GET single contact operation.
Implementing the PUT update contact operation.
Implementing the DELETE contact operation.
Adding routes for user registration, login, and getting current user.
Creating a User Controller for handling user-related operations.
Creating a Mongoose schema for users.
Implementing user registration and hashing passwords.
Generating JWT access tokens and implementing user login.
Creating middleware to verify JWT tokens and protect routes.
Handling the relationship between users and contacts.
Implementing GET all contacts for the logged-in user.
Implementing POST create new contact for the logged-in user.
Implementing PUT update and DELETE contact for the logged-in user.