summaryrefslogtreecommitdiff
path: root/srv/cmd/mediocre-blog
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2021-07-31 16:45:49 -0600
committerBrian Picciano <mediocregopher@gmail.com>2021-07-31 16:52:16 -0600
commit6bec0e3964f03f776841cec5e639784222a33958 (patch)
tree468d195614e6e12197ff571ec94a46692a999059 /srv/cmd/mediocre-blog
parent0655b192833bc39404ae71ef47a1d348d718aeaf (diff)
begin work on mailing list server, got the fundamental components done
Diffstat (limited to 'srv/cmd/mediocre-blog')
-rw-r--r--srv/cmd/mediocre-blog/main.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/srv/cmd/mediocre-blog/main.go b/srv/cmd/mediocre-blog/main.go
new file mode 100644
index 0000000..a1b20be
--- /dev/null
+++ b/srv/cmd/mediocre-blog/main.go
@@ -0,0 +1,24 @@
+package main
+
+import (
+ "flag"
+ "log"
+ "net/http"
+)
+
+func main() {
+ staticDir := flag.String("static-dir", "", "Directory from which static files are served")
+ //redisAddr := flag.String("redis-addr", "127.0.0.1:6379", "Address which redis is listening on")
+ listenAddr := flag.String("listen-addr", ":4000", "Address to listen for HTTP requests on")
+ flag.Parse()
+
+ if *staticDir == "" {
+ log.Fatal("-static-dir is required")
+ }
+
+ mux := http.NewServeMux()
+ mux.Handle("/", http.FileServer(http.Dir(*staticDir)))
+
+ log.Printf("listening on %q", *listenAddr)
+ log.Fatal(http.ListenAndServe(*listenAddr, mux))
+}