box-o-sand/html5/server.go

23 lines
450 B
Go
Raw Normal View History

// I wanted to practice, plus maaaaaybe I'll want something dynamic on the
// server side (???)
package main
import (
"flag"
"fmt"
"net/http"
)
var (
docroot = flag.String("d", ".", "docroot for server")
addr = flag.String("a", ":8990", "address on which to listen")
)
func main() {
flag.Parse()
http.Handle("/", http.FileServer(http.Dir(*docroot)))
fmt.Printf("Serving %q on %v\n", *docroot, *addr)
http.ListenAndServe(*addr, nil)
}