A simple RESTful Task Management API built with Go (Golang) using:
- Gin – HTTP web framework
- GORM – ORM for PostgreSQL
- JWT – JSON Web Token authentication
- PostgreSQL (via Docker or Homebrew)
- RESTful best practices and modular architecture
- ✅ User Registration & Login (with hashed passwords)
- ✅ JWT-based Authentication
- ✅ Create / Read / Update / Delete (CRUD) Tasks
- ✅ Middleware-protected routes
- ✅ PostgreSQL integration via GORM
docker run --name pg-container
-e POSTGRES_USER=yourusername
-e POSTGRES_PASSWORD=yourpassword
-e POSTGRES_DB=taskdb
-p 5432:5432
-d postgres
git clone https://github.com/yourusername/go-task-api.git
cd go-task-api
go mod tidy
go run main.go
- Register
curl -X POST http://localhost:8080/api/auth/register \
-H "Content-Type: application/json" \
-d '{"username":"bismayam","password":"secret"}'
- Login
curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"bismayam","password":"secret"}'
- Create Task
curl -X POST http://localhost:8080/api/tasks \
-H "Authorization: Bearer <jwt-token>" \
-H "Content-Type: application/json" \
-d '{"title":"Test", "description":"Test Task", "completed":false}'