A simple login API endpoint built using a scalable MVC architecture. It only handles login, not signup.
Upon successful login, the endpoint returns a JWT token signed with a secret key and valid for 60 minutes.
- Scalable MVC structure with clear separation of concerns.
- Modular design.
- Uses DI for clean dependency management and testability.
- Uses interfaces for loose coupling between layers and services.
- Proper error handling using a custom error structure
AppError.
- Go 1.24.x
git clone https://github.com/ashishDevv/login-task.gitgo downloadAPP_PORT=8080
DB_URL=""
AUTH_SECRET=supersecretkey
AUTH_EXPIRY_MIN=60go build cmd/main.go./mainPOST /login
Content-Type: application/json
{
"email": "ashu@gmail.com",
"password": "12345"
}{
"id": 1,
"token": "JWT token with 60min expiry"
}