From 75539a6e72a58a3ec2600a1aa902790660e09791 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Fri, 7 Mar 2025 19:13:17 -0500 Subject: initial commit --- main.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 main.go (limited to 'main.go') diff --git a/main.go b/main.go new file mode 100644 index 0000000..d6d7455 --- /dev/null +++ b/main.go @@ -0,0 +1,26 @@ +package main + +import ( + "log" + "net/http" + "strings" + + "pablotron.org/jim-bot/bot" +) + +// serve home page +func doHome(w http.ResponseWriter, _ *http.Request) { + // generate respones body + body := []byte(strings.Join(bot.N(10), "\n") + "\n") + + // write header and response + w.Header().Add("Content-Type", "text/plain") + if _, err := w.Write(body); err != nil { + log.Print(err) + } +} + +func main() { + http.HandleFunc("/", doHome) + http.ListenAndServe(":8080", nil) +} -- cgit v1.2.3