Skip to content

hanumachari/go-hello-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Go HTTP Server

This is a basic HTTP server written in Go that listens on port 8080 and responds with "Hello, World!" to any request.

📌 Prerequisites

  • Go (>=1.16) installed on your machine
  • Git (optional, for cloning the repository)

🚀 Installation & Running

1️⃣ Clone the Repository (Optional)

If you haven't already cloned the repository, run:

git clone https://github.com/hanumachari/go-hello-server.git
cd go-hello-server

2️⃣ Run the Server

Execute the following command to start the server:

go run main.go

You should see this output:

Server is running on port 8080...

3️⃣ Test the Server

Open your browser or use curl to test:

curl http://localhost:8080

✅ Expected output:

Hello, World!

🔧 Building the Binary

To compile the server into an executable, run:

go build -o server

Then run the binary:

./server

🐳 Docker Support

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published