From 6bec0e3964f03f776841cec5e639784222a33958 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sat, 31 Jul 2021 16:45:49 -0600 Subject: begin work on mailing list server, got the fundamental components done --- srv/cmd/mediocre-blog/main.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 srv/cmd/mediocre-blog/main.go (limited to 'srv/cmd') 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)) +} -- cgit v1.2.3