Users API
This application follows the Model, View, and Controller (MVC) pattern.
It also uses the gin HTTP framework to handle the server.
User is the core domain of this application.
- Golang(>11.0)
- GNU Make
- Docker
- Docker Compose
MYSQL_URL=root:passwd@tcp(127.0.0.1:3305)/users_db?charset=utf8
# Install dependencies
make install
# Run postgres locally as a container
make env
# Run server locally
make run
# Run server locally with custom environment variables
MYSQL_URL=root:passwd@tcp(127.0.0.1:3305)/users_db?charset=utf8 \
make run
After cloning the repository, change the git hooks path so it's only possible to commit code with the required quality.
make git-config
To view report of tests locally use the following command:
make env # prepares environment for testing
make test
make lint
Lint report generate by GolangCI-lint.
make audit
Audit report generate by Nancy.
make build
Tip: Do not forget to login to docker hub account.
docker login -u "username" -p "access_token" docker.io
make image tag push
make image
make tag VERSION=1.0.0
sudo make push VERSION=1.0.0
Note: Change the version to the desired version.
Tip: Before running it locally you need to prepare the environment with the following command.
make env
It creates the network and the database containers.
make run-docker
make remove-docker
The package structure used in this project was inspired by the golang-standards project.
The project layers structure used in this project was inspired by the Hexagonal Architecture (Ports & Adapters).
See CONTRIBUTING documentation for more details.
See CHANGELOG documentation for more details.