From 43207aaada95cdf5bdeecca847c511594791ac98 Mon Sep 17 00:00:00 2001 From: sp Date: Wed, 24 Feb 2021 15:13:34 +1100 Subject: [PATCH] first simple http server is up and running --- main.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 main.go diff --git a/main.go b/main.go new file mode 100644 index 0000000..be62989 --- /dev/null +++ b/main.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + "log" + "net/http" +) + +func main() { + + http.HandleFunc("/", HelloHandler) + fmt.Println("Server started at port 8080") + log.Fatal(http.ListenAndServe(":8080", nil)) +} + +func HelloHandler(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "Hello, there\n") +}