You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
597 B

package main
import (
"flag"
"fmt"
"io"
"net/http"
"github.com/urfave/negroni"
)
var (
addrFlag = flag.String("a", ":9745", "addr at which to listen")
distDir = flag.String("d", "dist", "directory in which are the dist 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(*distDir)))
n.Use(negroni.NewLogger())
n.UseHandler(mux)
fmt.Printf("Serving at %v\n", *addrFlag)
http.ListenAndServe(*addrFlag, n)
}