box-o-sand/vuefun/app.go
2019-07-11 19:12:14 -04:00

32 lines
556 B
Go

package main
import (
"flag"
"io"
"net/http"
"github.com/urfave/negroni"
)
var (
addrFlag = flag.String("a", ":9745", "addr at which to listen")
staticDir = flag.String("s", "static", "directory in which are the static bits")
)
func main() {
flag.Parse()
mux := http.NewServeMux()
mux.HandleFunc(`/api/`, func(w http.ResponseWriter, req *http.Request) {
io.WriteString(w, "welp")
})
n := negroni.New()
n.Use(negroni.NewStatic(http.Dir(*staticDir)))
n.Use(negroni.NewLogger())
n.UseHandler(mux)
http.ListenAndServe(*addrFlag, n)
}