A project built with Node.js, Express, and MongoDB to manage contacts with CRUD operations and user authentication.
- Node.js
- Express.js
- MongoDB & Mongoose
- JWT for Authentication
- Nodemon – Watches files & restarts server on save.
- Thunder Client – For testing API endpoints.
- REST API for managing contacts.
- User registration and login with JWT authentication.
- CRUD operations for contacts.
- Modular and scalable backend structure.
- Clone the repository:
git clone https://github.com/your-username/contact-manager-backend.git
- Navigate into the project directory:
cd contact-manager-backend
- Install dependencies:
npm install
- Create a .env file in the root and add:
PORT=5001 MONGO_URI=your_mongo_connection_string JWT_SECRET=your_secret_key
- Start the development server:
or directly with Nodemon:
npm run dev
nodemon server.js
- POST /api/users/register – Register a new user
- POST /api/users/login – Login and get JWT token
- GET /api/contacts – Get all contacts
- POST /api/contacts – Add a contact
- GET /api/contacts/:id – Get a single contact
- PUT /api/contacts/:id – Update a contact
- DELETE /api/contacts/:id – Delete a contact
Use Thunder Client (VS Code Extension) or Postman to test API routes.