Skip to content

wisdommatt/todo-list-api

Repository files navigation

Todo List API

Todo List REST API written in Go (Golang).

Explanation

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)

Database

This API uses mongodb as the primary database.

How to execute / use

  • Using docker (recommended) run docker-compose up and connect to localhost:5555
  • Using local mongodb and go installation, run go run main.go then adjust environment variables in .env to fit your current setup.

Endpoints

Create new user

POST: /users/

Sample Payload:

{
   "firstName": "Wisdom",
   "lastName": "Matthew",
   "email": "talk2wisdommatt@gmail.com",
   "password": "password"
}

Login User

POST: /users/login

Sample Payload:

{
   "email": "talk2wisdommatt@gmail.com",
   "password": "password",
}

Get User

GET: /users/{userId}


Get Users

GET: /users/?lastId=&limit=20

lastId and limit url parameters are used for pagination.


Delete User

DELETE: /users/{userId}


Create Task

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 Task

GET: /tasks/{taskId}


Get Tasks

GET: /users/{userId}/tasks?lastId=&pagination=20


Update Task

PUT: /tasks/{taskId}

Sample Payload:

{
    "status": "COMPLETED"
}

Delete Task

DELETE: /tasks/{taskId}

About

Repository for REST API todo list backend written in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages