From 5c8d644105f7cd95c99577289231d66f6aeda11a Mon Sep 17 00:00:00 2001 From: "Brandon C. Irizarry" Date: Wed, 6 May 2026 12:18:23 -0400 Subject: feat: implement trivial hello-world web server --- main.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/main.go b/main.go index 7905807..3512c24 100644 --- a/main.go +++ b/main.go @@ -1,5 +1,28 @@ package main +import ( + "io" + "log" + "net/http" +) + +type handler struct{} + +func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + io.WriteString(w, "Hello world!") +} + func main() { + mux := http.NewServeMux() + + mux.Handle("/{$}", &handler{}) + + srv := http.Server{ + Addr: ":8080", + Handler: mux, + } + log.Println("Serving on port 8080...") + log.Fatal(srv.ListenAndServe()) } -- cgit v1.2.3