A RESTful API for a task manager where users can create, update, delete, and retrieve tasks.
- User Authentication (Sign up & Login)
- Create Tasks (Add a new task with title, description, status)
- View Tasks (Get a list of all tasks or a single task)
- Update Tasks (Change task details)
- Delete Tasks (Remove a task)
- API Documentation with Swagger
- Backend: Node.js with Express.js
- Database: SQLite
- Authentication: JWT (JSON Web Tokens)
- API Documentation: Swagger UI
- Node.js (v14 or above)
- npm (v6 or above)
- Clone this repository
git clone <repository-url>
cd task-manager-api- Install dependencies
npm install- Configure environment variables
Create a
.envfile in the root directory and add:
PORT=3000
JWT_SECRET=your_jwt_secret_key
NODE_ENV=development
- Start the development server
npm run devThe server will start at http://localhost:3000
Once the server is running, you can access the Swagger documentation at:
http://localhost:3000/api-docs
POST /api/users/register- Register a new userPOST /api/users/login- Login a userGET /api/users/me- Get current user details
GET /api/tasks- Get all tasks for current userGET /api/tasks/:id- Get a specific taskPOST /api/tasks- Create a new taskPUT /api/tasks/:id- Update a taskDELETE /api/tasks/:id- Delete a task
You can use Postman or any API client to test the endpoints. Make sure to include the JWT token in the Authorization header for protected routes:
Authorization: Bearer <your_jwt_token>