main go-apis/lessons/02-your-first-http-server

README.md

Lesson 2: Your first HTTP server

Your first HTTP server comes up in almost every real Go project. We start with the why, then write code together.

Read the full lesson: https://glibcode.net/courses/go-apis/lessons/2

Files

  • main.go: a hello endpoint with net/http

Tip: Run gofmt -w . before committing; nobody argues about formatting in Go.

Tip: go vet ./... catches mistakes the compiler allows.

Tip: go doc net/http.HandlerFunc shows the docs without leaving the terminal.

Run it

go run ./lessons/02-your-first-http-server

Exercises

See exercises.md. Ask in the forum after you have tried.