box-o-sand/vuefun/app.go

32 lines
556 B
Go
Raw Normal View History

2019-03-10 00:37:28 +00:00
package main
2019-07-11 23:12:14 +00:00
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")
)
2019-03-10 00:37:28 +00:00
func main() {
2019-07-11 23:12:14 +00:00
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)
2019-03-10 00:37:28 +00:00
}