This commit is contained in:
Bel LaPointe
2022-02-08 10:27:33 -07:00
parent f09d8e6cc9
commit 8f8dd81404
6 changed files with 97 additions and 4 deletions

View File

@@ -1,13 +1,20 @@
package main
import "net/http"
import (
"local/args"
"net/http"
"strconv"
)
func main() {
s := NewServer()
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(":3004", s); err != nil {
if err := http.ListenAndServe(":"+strconv.Itoa(as.GetInt("p")), s); err != nil {
panic(err)
}
}