An open API service indexing awesome lists of open source software.

https://github.com/ega4432/go-rest-api-docker


https://github.com/ega4432/go-rest-api-docker

air api docker docker-compose go go-rest-api-docker golang mysql rest rest-api

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          

# go-rest-api-docker

[![ci](https://github.com/ega4432/go-rest-api-docker/actions/workflows/ci.yaml/badge.svg)](https://github.com/ega4432/go-rest-api-docker/actions/workflows/ci.yaml)

## Overview

This repository is a template for a Todo application in the Golang that can run on any platform as long as Docker is running.

MySQL is used as the data store.

## Endpoints

Method | Path | Description
--- | --- | ---
GET | `/tasks` | Get all tasks |
POST | `/tasks` | Create a new task |
GET | `/tasks/{id}` | Get a task |
PUT | `/tasks/{id}` | Update a task |
DELETE | `/tasks/{id}` | Delete a task |

## Usage

```shell
$ git clone git@github.com:ega4432/go-rest-api-docker.git && cd go-rest-api-docker

$ cp .env.example .env

$ docker compose up --build
```

## Tips

### Connect db container

```shell
$ docker compose exec -it db /bin/bash -c "mysql -uroot -p"
```

### Import API test file with Thunder client

1. Install extension from [here](https://marketplace.visualstudio.com/items?itemName=rangav.vscode-thunder-client)
2. Import [JSON file](https://github.com/ega4432/go-rest-api-docker/blob/main/.vscode/thunder-collection_go-rest-api-docker.json)