todolist-mysql-go

command
v0.0.0-...-8b1ae5f Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 9 Imported by: 0

README

Introduction

Todo list MySQL API Written in Golang

Get Started

  • run the container
docker-compose up -d
  • run app
go run main.go

API SPEC

Get All Todo

Request :

  • Method : GET
  • Endpoint : /todo
  • Header :
    • Accept: application/json

Response :

  • Status: 200 OK
[
    {
        "ID": 1,
        "Description": "test",
        "Completed": false
    },
    {
        "ID": 2,
        "Description": "todo ke 2",
        "Completed": false
    },
    {
        "ID": 3,
        "Description": "testing",
        "Completed": true
    }
]

Get Todo With Status Completed

Request :

  • Method : GET
  • Endpoint : /todo-completed
  • Header :
    • Accept: application/json

Response :

  • Status: 200 OK
[
    {
        "ID": 3,
        "Description": "testing",
        "Completed": true
    }
]

Get Todo With Status Incompleted

Request :

  • Method : GET
  • Endpoint : /todo-incompleted
  • Header :
    • Accept: application/json

Response :

  • Status: 200 OK
[
    {
        "ID": 1,
        "Description": "test",
        "Completed": false
    },
    {
        "ID": 2,
        "Description": "todo ke 2",
        "Completed": false
    }
]

Create Todo

Request :

  • Method : POST
  • Endpoint : /todo/
  • Header :
    • Content-Type: application/json
    • Accept: application/json
  • Body :
{
    "description": "learn golang"
}

Response :

  • Status: 201 Created
{
    "ID": 1,
    "Description": "learn golang",
    "Completed": false
}

Update Todo

Request :

  • Method : PUT, PATCH
  • Endpoint : /todo/{id}
  • Header :
    • Content-Type: application/json
    • Accept: application/json
  • Body :
{
    "description": "update learn golang",
    "completed": "true"
}

Response :

  • Status: 204 No Content

Delete Todo

Request :

  • Method : DELETE
  • Endpoint : /todo/{id}
  • Header :
    • Content-Type: application/json
    • Accept: application/json

Response :

  • Status: 204 No Content

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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