- Node.js
- Express.js
- MongoDB
- JSON Web Tokens (JWT) for authentication
- bcrypt for password hashing
- dotenv
- express-async-handler
- mongoose
- nodemon
- >Clone the repository:
- >> bash
- >> git clone https://github.com/your-username/contact-management-backend.git
Install dependencies:
- > bash
- > cd contact-management-backend
- > npm install
- > Create a .env file in the root directory.
- > Add the following environment variables:
- >> makefile
- >> PORT=3000
- >> MONGODB_URI=your-mongodb-connection-string
- >> JWT_SECRET=your-jwt-secret
- > Start the server:
- >> bash
- >> npm start
- POST /api/users/register: Register a new user.
- POST /api/users/login: Login with email and password to get JWT token.
- GET /api/contacts: Get all contacts.
- POST /api/contacts: Create a new contact.
- GET /api/contacts/:id: Get a contact by ID.
- PUT /api/contacts/:id: Update a contact by ID.
- middlewares/: Custom middleware functions.
- controllers/: Request handlers for each route.
- models/: Mongoose schemas and models.
- routes/: Express routes for different endpoints.