Simple Contact Manager built with Node.js and Express.
This repository contains the backend implementation of MyContacts, a simple contact management application built using Node.js and Express. The project focuses on creating a RESTful API to handle CRUD operations for user contacts.
- RESTful API with Express
- MongoDB database using Mongoose
- User authentication with JWT (JSON Web Tokens)
- Middleware for handling token validation
- Error handling with custom middleware
- Secure password storage with bcrypt
GET /api/contacts
- Get all user contactsGET /api/contacts/:id
- Get a specific user contactPOST /api/contacts
- Create a new user contactPUT /api/contacts/:id
- Update a user contactDELETE /api/contacts/:id
- Delete a user contact
- User registration (
POST /api/auth/register
) - User login (
POST /api/auth/login
) - Protected routes with JWT authentication
- Users can only manipulate their own contacts
- Authorization middleware to check user permissions
- Clone the repository:
git clone https://github.com/AmanJ10/Contact-Manager.git
- Install dependencies:
npm install
- Set up your environment variables (e.g.,
.env
file) - Run the server:
npm start
Feel free to explore the code and contribute to the project! If you encounter any issues or have suggestions, please open an issue.
Image showing the GET request (all contacts of the User are shown).