-
Set up your environmental variables by changing file name from
.env.tmplateto.envand specify the following variables.APP_ENV=LOCAL MYSQL_USER= MYSQL_PASSWORD= MYSQL_ALLOW_EMPTY_PASSWORD=falseAPP_ENVcontrols where this app is executed. Available variables areLOCALfor local environment,DEVfor developing environment (dev-api-ocwcentral.onrender.com), andPRODfor production environment (api-ocwcentral.onrender.com).MYSQL_*are settings for a local mysql container. You can specify any value you want.
-
Start the container of this app.
docker-compose up --build -
You need to import data into the database at the first time. The mock data is available here. You can import it by running the following command.
mysql -p <MYSQL_PASSWORD> -h 127.0.0.1 ocw-central < /path/to/dump/file.sql -
Access to localhost:8080 and you can see the app.
The following is the directory tree.
We adopt Clean architecture and DDD as our design pattern.
Please refer to other articles for the Clean architecture and DDD.
.
├── LICENSE.md
├── README.md
├── docker // Directory for Dockerfiles and entrypoint scripts
├── docker-compose.yml
├── domain
│ ├── repository // Clean architecture repository
│ └── usecase // Clean architecture usecase
├── env
│ └── env.go // File that maps env variables to a go struct
├── go.mod
├── go.sum
├── gqlgen.yml // Setting file for `gqlgen` package
├── graph // Directory for graphql controller
├── interactor // Clean architecture interactor
├── migrations // Directory for database migration files
├── model // DDD model
├── persistence // Clean architecture repository implementations
├── server.go // Entry point file to start the server
├── tools // File that defines tools necessary only for development
├── utils
├── wire.go // Setting file for dependency injection
└── wire_gen.go // Auto-generated file by `wire` command
