You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
612 B
24 lines
612 B
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))
|
|
}
|
|
|