summaryrefslogtreecommitdiff
path: root/srv/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'srv/cmd')
-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))
+}