func main() { flag.Parse() if os.Getenv("HOST") != "" || os.Getenv("PORT") != "" { *addr = os.Getenv("HOST") + ":" + os.Getenv("PORT") } dir := http.Dir("ui") pkg := livepkg.NewServer(dir, *dev, "/main.js", "/main.css") http.Handle("/ui/", http.StripPrefix("/ui", pkg)) http.HandleFunc("/", index) assets := http.Dir("assets") http.Handle("/assets/", http.StripPrefix("/assets", http.FileServer(assets))) log.Println("starting listening on ", *addr) http.ListenAndServe(*addr, nil) }
func main() { flag.Parse() pkg := livepkg.NewServer(http.Dir(*root), *dev, flag.Args()...) http.ListenAndServe(*addr, pkg) }