notea-de-me/spike/review/reinvent/ezmded/server/main.go

21 lines
433 B
Go

package main
import (
"local/args"
"net/http"
"strconv"
)
func main() {
as := args.NewArgSet()
as.Append(args.INT, "p", "port to listen on", 3004)
as.Append(args.STRING, "d", "root dir with /index.html and /media and /files", "./public")
s := NewServer(as.GetString("d"))
if err := s.Routes(); err != nil {
panic(err)
}
if err := http.ListenAndServe(":"+strconv.Itoa(as.GetInt("p")), s); err != nil {
panic(err)
}
}