diff --git a/httpserver/go.mod b/httpserver/go.mod new file mode 100644 index 0000000..a40af2c --- /dev/null +++ b/httpserver/go.mod @@ -0,0 +1,3 @@ +module httpserver + +go 1.22.2 diff --git a/httpserver/main.go b/httpserver/main.go new file mode 100644 index 0000000..d119dbf --- /dev/null +++ b/httpserver/main.go @@ -0,0 +1,21 @@ +package main + +import ( + "fmt" + "log" + "net/http" +) + +func getRoot(w http.ResponseWriter, r *http.Request) { + fmt.Printf("Received connection\n") + fmt.Fprintln(w, "Hello!") +} + +func main() { + http.HandleFunc("/", getRoot) + + err := http.ListenAndServe(":8080", nil) + if err != nil { + log.Fatal(err) + } +}