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

https://github.com/the-arcade-01/go-api

basic go api using go-chi, mysql, docker
https://github.com/the-arcade-01/go-api

docker docker-compose go go-chi mysql

Last synced: 2 months ago
JSON representation

basic go api using go-chi, mysql, docker

Awesome Lists containing this project

README

          

## go-api-docker-example

### Docker commands

```bash
docker compose build
docker compose up
```

### Env file

```bash
PORT=:5000
DATABASE_URL=:@tcp(:3306)/?parseTime=true
DB_DRIVER=mysql
MYSQL_RANDOM_ROOT_PASSWORD=
MYSQL_DATABASE=
MYSQL_USER=
MYSQL_PASSWORD=
```

### API commands

1. Fetching todos from DB

```bash
curl -X GET 'http://localhost:5000/todos'
```

2. Inserting todos in DB

```bash
curl -X POST 'http://localhost:5000/todos' -d '{"task": "Learn Go", "completed": false}'
```