Todo List REST API written in Go (Golang).
This is a task management api sample project.
To avoid unnecessary complexity and overengineering i decided to:
- Use just logs rather than implementing tracing with open telemetry.
- Maintain a simple folder structure.
- Write less tests for duplicated use cases (mainly because it's an sample project)
This API uses mongodb as the primary database.
- Using docker (recommended) run
docker-compose up
and connect tolocalhost:5555
- Using local mongodb and go installation, run
go run main.go
then adjust environment variables in.env
to fit your current setup.
POST: /users/
Sample Payload:
{
"firstName": "Wisdom",
"lastName": "Matthew",
"email": "talk2wisdommatt@gmail.com",
"password": "password"
}
POST: /users/login
Sample Payload:
{
"email": "talk2wisdommatt@gmail.com",
"password": "password",
}
GET: /users/{userId}
GET: /users/?lastId=&limit=20
lastId
and limit
url parameters are used for pagination.
DELETE: /users/{userId}
POST: /tasks/
Sample Payload:
{
"title": "Run 20 minutes",
"startTime": "2022-02-18T11:01:00.000+00:00",
"endTime": "2022-02-18T12:00:00.000+00:00",
"userId": "6212c3112e46aabc11bbee1c",
"reminderPeriod": "2022-02-18T12:00:00.000+00:00"
}
GET: /tasks/{taskId}
GET: /users/{userId}/tasks?lastId=&pagination=20
PUT: /tasks/{taskId}
Sample Payload:
{
"status": "COMPLETED"
}
DELETE: /tasks/{taskId}