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

alsacad/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 drive 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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 85.6%
  • Makefile 10.4%
  • Dockerfile 4.0%