24 lines
485 B
Go
24 lines
485 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")
|
|
if err := as.Parse(); err != nil {
|
|
panic(err)
|
|
}
|
|
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)
|
|
}
|
|
}
|