aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go26
1 files changed, 26 insertions, 0 deletions
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)
+}