examples/http-server/README.md
This GoFr example demonstrates a simple HTTP server which supports Redis and MySQL as datasources.
From the project root (/gofr):
docker compose -f examples/http-server/docker/docker-compose.yml up -d
Explanation:
-f examples/http-server/docker/docker-compose.yml → path to the docker-compose fileup -d → builds (if needed) and runs services in detached modeFrom the project root (/gofr):
docker build -f examples/http-server/Dockerfile -t http-server:latest .
Explanation:
-f examples/http-server/Dockerfile → path to the Dockerfile-t http-server:latest → tag for the Docker image. → build context (project root; needed for go.mod and go.sum)docker run -p 9000:9000 --name http-server http-server:latest
Explanation:
-p 9000:9000 → maps container port 9000 to host port 9000--name http-server → optional, gives your container a nameUse Compose when you want the whole stack (app + Redis + MySQL + Grafana + Prometheus).
Use Docker build/run when you just want to run the app container alone.
To test the example, follow these steps:
http://localhost:9000/hello.https://tracer.gofr.dev and paste the traceid.http://localhost:3000. The dashboard UI will be displayed. Use the default admin credentials to log in:
adminpassword