This is a basic HTTP server written in Go that listens on port 8080 and responds with "Hello, World!" to any request.
- Go (>=1.16) installed on your machine
- Git (optional, for cloning the repository)
If you haven't already cloned the repository, run:
git clone https://github.com/hanumachari/go-hello-server.git
cd go-hello-serverExecute the following command to start the server:
go run main.go
You should see this output:
Server is running on port 8080...
Open your browser or use curl to test:
curl http://localhost:8080
✅ Expected output:
Hello, World!
To compile the server into an executable, run:
go build -o server
./server
To containerize the application using Docker 🔹 Build and Run the Container on linux host machine
docker build -t go-server .
docker run -p 8080:8080 go-server
Note: If your host machine is running macOS, copy the relevant Dockerfile from the Docker directory to the project root directory before building the Docker image.