diff options
author | Paul Duncan <pabs@pablotron.org> | 2025-03-07 19:13:17 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2025-03-07 19:13:17 -0500 |
commit | 75539a6e72a58a3ec2600a1aa902790660e09791 (patch) | |
tree | e15f4db3f8ce3ba5c356793887328273de829b9b /main.go | |
download | jim-bot-75539a6e72a58a3ec2600a1aa902790660e09791.tar.xz jim-bot-75539a6e72a58a3ec2600a1aa902790660e09791.zip |
initial commitr20250307
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -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) +} |