Skip to content

F0rzend/simple-go-webserver

Repository files navigation

SimpleGoWebserver

GitHub release (latest by date) GitHub top language GitHub go.mod Go version Swagger Validator

There is a simple webserver written in Go.

We use DDD (Domain Driven Design) to separate the domain logic from the application logic.

Features

Run in docker (Recommended)

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.

Build from source

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

Run project via docker compose

You can run the project via docker compose. See the docker-compose.yml file.