30 lines
470 B
Go
30 lines
470 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
"path"
|
|
"path/filepath"
|
|
|
|
"google.golang.org/appengine"
|
|
)
|
|
|
|
func main() {
|
|
exePath, err := filepath.Abs(filepath.Dir(os.Args[0]))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
exePath = "."
|
|
|
|
directory := flag.String("d", path.Join(exePath, "public"), "the directory of static file to host")
|
|
flag.Parse()
|
|
|
|
http.Handle("/", http.FileServer(http.Dir(*directory)))
|
|
|
|
log.Printf("Serving %s\n", *directory)
|
|
|
|
appengine.Main()
|
|
}
|