- Overview
- Project Structure
- How to Run
- How to Build
- How to Test
- How to Release
- GitHub Actions (CI)
- Contact
-
This is a web server for creating, listing, updating, and deleting tasks.
-
Data storage uses an in-memory mechanism, meaning it will only exist during runtime.
-
For the API documentation, please refer to Swagger
-
Follow Golang Project Layout
-
mock
directories store generated files by gomock for unit tests.
.
├── cmd # Applications
│ └── todo
│ ├── config # Config files for the application
│ └── docs # Documents for the application
├── internal # Private application and library code. only use for specific cases
│ ├── controller # Put business log here
│ │ └── mock
│ ├── db # Implement in-memory storage mechanism
│ │ └── mock
│ ├── https
│ │ ├── server # Server instance and middleware
│ │ │ └── handler # Handle converting data from request
│ │ └── test # HTTP Server integration tests
│ ├── models # Data types
│ └── store # Handle converting data from db
│ └── mock
└── pkg # Library code that's ok to use by external applications
├── config # Reading config from env, file and default values.
├── http
│ └── server # HTTP Server Middleware
├── logger
└── validator
docker run -p 8080 dragon0huang/todo-go:latest
docker compose up
make todo
- Set Env
export HTTP_SERVER__ADDR_PORT=127.0.0.1:8080
- Using toml config file
make build
go test ./...
- Create a git tag with
${component}-v${version}
and push. Example:
git tag todo-v1.0.0
git push origin todo-v1.0.0
- Env will override variables from the config file
- Set
OPERATION__LOG_LEVEL
todebug
will also set logger to debug mode.
- When you push to specified branches or create a pull request, two workflows are triggered:
- Validate the code by running linter checks, tests, and builds.
- Build two types of Docker images: distroless and alpine for debugging.
For any questions or suggestions, feel free to contact me at [email protected].