https://github.com/yagikota/clean-architecture-with-go
This is a sample API built by Go(Echo) and SQLBoiler according to Clean Architecture.
https://github.com/yagikota/clean-architecture-with-go
clean-architecture echo golang mysql sqlboiler
Last synced: 6 months ago
JSON representation
This is a sample API built by Go(Echo) and SQLBoiler according to Clean Architecture.
- Host: GitHub
- URL: https://github.com/yagikota/clean-architecture-with-go
- Owner: yagikota
- Created: 2022-08-23T15:32:04.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-26T13:31:24.000Z (over 1 year ago)
- Last Synced: 2024-01-26T14:45:11.223Z (over 1 year ago)
- Topics: clean-architecture, echo, golang, mysql, sqlboiler
- Language: Go
- Homepage:
- Size: 95.7 KB
- Stars: 28
- Watchers: 0
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# clean-architecture-with-go
## 🗄 About this repository
* This is a sample API built by Go(Echo) and SQLBoiler according to Clean Architecture.## 👟 How to run
### install
#### this repository
```shell
git clone git@github.com:yagikota/clean-architecture-with-go.gitcd clean_architecture-with-go
```
#### [SQLBoiler](https://github.com/volatiletech/sqlboiler#getting-started)
```shell
$ go install github.com/volatiletech/sqlboiler/v4@latest
# install driver for MySQL
$ go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-mysql@latest
```#### [golang-migrate](https://formulae.brew.sh/formula/golang-migrate)
```shell
brew install golang-migrate
```### set environment variables
```shell
echo "PORT=8080MYSQL_USER=root
MYSQL_ROOT_PASSWORD=
MYSQL_ALLOW_EMPTY_PASSWORD=true
MYSQL_PORT=3306
MYSQL_ADDR=mysql:3306
MYSQL_DATABASE=sample" > .env
```### initialize local DB
```shell
make run-db
make migrate
make seed
```
`make migrate` command may fail, but try some time.### build API
```shell
make run-go
```
and access`localhost:8080/health_check`.
You will get the following response.
```json
{
"message": "Hello! you've requested: /health_check"
}
```
Then, you have fully prepared for running API.## 📄 API Document
* Please copy and paste [this file](https://github.com/yagikota/clean_architecture_with_go/blob/main/api_doc.yml) on https://editor.swagger.io/ .🐶 I hope this repository helps you studying Clean Architecture with Go.