# Task Manager RESTful API using Golang, Echo, and PostgreSQL
This repository contains a RESTful API implemented in Go using the Echo framework and PostgreSQL database for managing tasks. The API allows users to register, log in, create, read, update, and delete tasks. Users can only access their own tasks after authentication. Concurrency is demonstrated through Goroutines and channels for marking tasks as "done" concurrently.
- Getting Started
 - Authentication & Authorization
 - Task Management
 - Database Integration
 - Middleware & Error Handling
 - Concurrency
 - Documentation
 - Postman Collection
 
- Go installed on your system. You can download it from here.
 
- Clone the repository:
git clone git@github.com:SagarKansara98/task-api.git
 - Change directory to the project folder:
cd task-api/app - Install dependencies:
go mod tidy; go mod vendor 
- Create a PostgreSQL database and update the database configuration in 
config/config.go. - Set environment variables for authentication JWT secret and other sensitive data.
 - Run the migration (as time permit i have not configure migrate cli so it's just like run the query present in migration folder)
 
- User registration and login endpoints are provided.
 - Authentication is implemented using JWT (JSON Web Tokens).
 - Users can only access their own tasks after authentication.
 
POST /api/v1/user: Register a new user.POST /api/v1/user/login: Log in with registered credentials.GET /api/v1/user: return login user details.PUT /api/v1/user: update login user details.Delete /api/v1/user: delete login user.
GET /api/v1/task: Get all tasks for the authenticated user.POST /api/v1/task: Create a new task.GET /api/v1/task/:id: Get a specific task by ID.PUT /api/v1/task/:id: Update a task by ID.DELETE /api/v1/task/:id: Delete a task by ID.PATCH /api/v1/task/mark-as-done: Mark multiple tasks as "done" concurrently.
- Each task must have a 
title,description, andstatus. - Valid 
statusvalues: "todo", "in progress", "done". 
- PostgreSQL database is used for persistent storage.
 
- Middleware is implemented for authentication and logging incoming requests.
 - Errors are handled gracefully, providing meaningful error responses with appropriate status codes.
 
- The API allows marking multiple tasks as "done" concurrently using Goroutines and channels.
 - Concurrency is implemented in the 
POST /api/v1/mark-as-doneendpoint. 
- How to Run the Application:
- Set up the PostgreSQL database and configure the database connection in 
config/config.go. - Set environment variables for sensitive data.
 - Run the application using the following command: (please add path to app directotry)
go run main.go
 
 - Set up the PostgreSQL database and configure the database connection in 
 - Authentication:
- User registration and login are required for accessing task-related endpoints.
 - Use the JWT token obtained after login for authentication. Include the token in the Authorization header as 
Bearer <token>for authenticated requests. 
 - Error Responses:
- API endpoints provide meaningful error responses with appropriate status codes and error messages.
 
 - Concurrency:
- The 
POST /api/v1/task/mark-as-doneendpoint allows marking multiple tasks as "done" concurrently using Goroutines and channels. 
 - The 
 
Import the provided Postman Collection to test the API endpoints directly.