todo-list-api

command module
v0.0.0-...-cff06d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

README

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}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
jwt
services

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL