Skip to content

This is a sample API built by Go(Echo) and SQLBoiler according to Clean Architecture.

Notifications You must be signed in to change notification settings

yagikota/clean-architecture-with-go

Repository files navigation

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

git clone git@github.com:yagikota/clean-architecture-with-go.git

cd clean_architecture-with-go
$ go install github.com/volatiletech/sqlboiler/v4@latest
# install driver for MySQL
$ go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-mysql@latest
brew install golang-migrate

set environment variables

echo "PORT=8080

MYSQL_USER=root
MYSQL_ROOT_PASSWORD=
MYSQL_ALLOW_EMPTY_PASSWORD=true
MYSQL_PORT=3306
MYSQL_ADDR=mysql:3306
MYSQL_DATABASE=sample" > .env

initialize local DB

make run-db
make migrate 
make seed

make migrate command may fail, but try some time.

build API

make run-go

and accesslocalhost:8080/health_check. You will get the following response.

{
    "message": "Hello! you've requested: /health_check"
}

Then, you have fully prepared for running API.

📄 API Document

🐶 I hope this repository helps you studying Clean Architecture with Go.

About

This is a sample API built by Go(Echo) and SQLBoiler according to Clean Architecture.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published