There is a simple webserver written in Go.
We use DDD (Domain Driven Design) to separate the domain logic from the application logic.
- The project uses the structure proposed in the book Go with domain
- moq for adapters mocking
- Swagger
- OpenAPI
- chi router
- Docker
- docker-compose
- GitHub Actions
It's simple to run it with docker. You don't even need to clone the project to your repository:
docker run \
-e ADDRESS=0.0.0.0:8080 \
ghcr.io/f0rzend/simplegowebserver:master
There is also some environment variables you can set, to configure project. Read more about it in the docker documentation.
List of available environment variables above.
Variable | Description | Default |
---|---|---|
ADDRESS |
Address to listen on | :8080 |
Be carefully. If you want to run it on localhost in docker container,
you need to set ADDRESS
to 0.0.0.0:8080
.
If you want to build the project from source, you need to have Go and git installed.
Firstly you need to clone the project repository on your local machine:
git clone https://github.com/F0rzend/SimpleGoWebserver.git
Entry point is cmd/api/main.go
file.
Then you need to go to the project directory and build it:
cd SimpleGoWebserver && go build -o simplegowebserver cmd/api/main.go
Now you can run the project. You must be in the same folder as the binary and run the following command:
./simplegowebserver
After this you will see the following message:
0:00AM INF cmd/api/main.go:27 > starting server on :8080
You can run the project via docker compose. See the docker-compose.yml file.