Task Management API
This is a Node.js Express API for managing tasks, including user authentication and profile management.
Features
- User Authentication (Registration, Login)
- Task Management (Create, Read, Update, Delete tasks)
- User Profile Management
Technologies Used
- Node.js
- Express.js
- Mongoose (for MongoDB interaction)
- bcrypt (for password hashing)
- jsonwebtoken (for JWT authentication)
- dotenv (for environment variables)
Setup and Installation
- Clone the repository:
git clone <repository-url> cd task-management-api
- Install dependencies:
npm install
- Environment Variables:
Create a.envfile in the root directory and add the following:
ReplacePORT=5000 MONGO_URI=<Your MongoDB Connection String> JWT_SECRET=<Your JWT Secret Key><Your MongoDB Connection String>with your MongoDB URI and<Your JWT Secret Key>with a strong, random string.
Running the Application
- Development Mode (with Nodemon for auto-restarts):
npm run dev
- Production Mode:
npm start
The API will run on the port specified in your .env file (default: 5000).
API Endpoints (Examples)
(Note: Specific endpoints and request/response bodies would be detailed here after a full API review.)
POST /api/auth/register- Register a new userPOST /api/auth/login- Log in a userGET /api/profile- Get user profile (requires authentication)POST /api/tasks- Create a new task (requires authentication)GET /api/tasks- Get all tasks for the authenticated user
Testing
Currently, there are no dedicated test scripts. It is highly recommended to add unit and integration tests for all API endpoints to ensure functionality and stability.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the ISC License.