This is a simple HTTP service that returns "Hello, Betterplace!" when accessed at the root endpoint. It serves as a basic example of a Go web application using the Echo framework.
- Ensure you have Go installed (version 1.25 or later).
- Install Docker if you plan to build within a container.
-
Clone the Repository
git clone https://github.com/betterplace/betterplace-hello.git cd betterplace-hello -
Set Up Dependencies and Build
make setup build
setup: Downloads Go dependencies.build: Compiles thehellobinary.
-
Run Tests to ensure everything is working correctly:
make test
-
Build the Docker Image
make build
This command builds a Docker image with
hello. -
Display Build Information
make build-info
This will echo the remote tag for the Docker image, which you can use to identify and retrieve the newly built image from your container registry after pushing changes.
The process is fully configurable via environment variables.
PORT: The port number to listen on. Defaults to"8080".
Run the hello command with the required environment variables:
PORT=8080 ./helloThe service will start on the specified port and respond to requests at the
root endpoint /.
# Start the service on port 8080
PORT=8080 ./hello# Test the service
curl http://localhost:8080/
# Expected output: "Hello, Betterplace!\n"Apache License, Version 2.0 – See the LICENSE file in the source archive.