Golang: HTTP & Networking

Creating a simple “Hello World!” HTTP Server in Go

In this article, we will learn how to launch a simple HTTP server that responds with `Hello World!` text for all the requests. We will also dive deep into the Go HTTP server architecture.

Uday Hiwarale
RunGo
Published in
14 min readJan 26, 2020

--

(source: unsplash.com)

What is an HTTP server?

This question might sound dumb to you because if you are here to learn about how to create an HTTP server using Go programming language, then you definitely have an idea of what HTTP servers are.

Nonetheless, an HTTP server is a program that listens for HTTP requests on a port of the machine with a static or dynamic IP address. The HTTP protocol is an internet protocol made up of TCP and IP protocols.

When a browser (client) makes an HTTP request to a machine with a given address and port, it sends the data in packets to the machine. These packets are assembled by the HTTP server and the server may choose to respond with some data requested by the client over the same request connection.

While creating an HTTP server, we need to make sure that we are binding the server on the correct port. If the port isn’t correct, then all the requests made…

--

--