Just a documentation update

Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/aya/trunk@78 cec141ff-132a-4243-88a5-ce187bd62f94
This commit is contained in:
yakumo.izuru
2023-12-10 23:57:40 +00:00
parent cdccb2a932
commit ce6aacf82a
4 changed files with 8 additions and 6 deletions

View File

@@ -29,10 +29,11 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
log.Println(r.RemoteAddr, r.Method, rw.StatusCode, r.URL)
}
func HttpServe(Dir string) {
// This function is called by the `aya serve` subcommand
func HttpServe(Dir string, Port int) {
handler := &Handler{http.FileServer(http.Dir(Dir))}
http.Handle("/", handler)
addr := fmt.Sprintf(":%d", 8000)
addr := fmt.Sprintf(":%d", Port)
log.Printf("Listening on %s\n", addr)
log.Fatal(http.ListenAndServe(addr, nil))
}