Server now has ability to serve static files.

This commit is contained in:
Stephen McQuay 2013-01-06 15:20:54 -08:00
parent 31b81a10d7
commit c934ac6753
1 changed files with 19 additions and 0 deletions

19
main.go Normal file
View File

@ -0,0 +1,19 @@
package main
import (
"flag"
"log"
"net/http"
)
var addr = flag.String("addr", ":8000", "http service address")
var static_files = flag.String("static", "./static", "static files")
func main() {
flag.Parse()
http.Handle("/s/", http.StripPrefix("/s/",
http.FileServer(http.Dir(*static_files))))
if err := http.ListenAndServe(*addr, nil); err != nil {
log.Fatal("ListenAndServe:", err)
}
}