This project implements a RESTful API for managing contacts. It allows users to register, login, and perform CRUD operations on their contacts.
- User Registration: Users can create an account by providing a username, email, and password.
- User Login: Registered users can authenticate themselves by logging in with their credentials.
- Current User Profile: Authenticated users can retrieve their profile information.
- Contact Management:
- Retrieve all contacts.
- Retrieve a specific contact by ID.
- Create a new contact.
- Update an existing contact.
- Delete a contact.
- Node.js: Server-side JavaScript runtime environment.
- Express.js: Web application framework for Node.js.
- MongoDB: NoSQL database for storing user and contact data.
- Mongoose: MongoDB object modeling tool for Node.js.
- JWT (JSON Web Tokens): For user authentication and authorization.
- bcrypt: Library for hashing passwords.
git clone https://github.com/AakashSuresh2003/Contact_Management_CRUD_Application.gitcd contact-management-api
npm i express nodemon bcrypt jsonwebtoken express-async-handler mongoose- Create a .env file in the root directory.
- Define the following environment variables:
PORT=3000
MONGODB_URI=<your-mongodb-uri>
JWT_SECRET=<your-jwt-secret>npm start
- POST /register: Register a new user.
- POST /login: Authenticate user and generate JWT token.
- GET /current: Retrieve current user profile.
- GET /contacts: Retrieve all contacts.
- GET /contacts/:id : Retrieve a specific contact by ID.
- POST /contacts: Create a new contact.
- PUT /contacts/:id : Update an existing contact.
- DELETE /contacts/:id : Delete a contact.
This project is licensed under the MIT License.
Feel free to customize the content according to your project's specifics. Let me know if you need further assistance!