Skip to content

Commit

Permalink
Update the serve function
Browse files Browse the repository at this point in the history
  • Loading branch information
arekkusu66 authored Nov 20, 2024
1 parent 0c4b86a commit 619de69
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions serve/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ import (
//
//The mux parameter represents the http requests multiplexer and will default to http.DefaultServeMux if it is nil
func Dir(dirname string, mux *http.ServeMux) {
var handler *http.ServeMux
var handler *http.ServeMux = http.DefaultServeMux

if mux != nil {
handler = mux
} else {
handler = http.DefaultServeMux
}

handler.Handle(fmt.Sprintf("%s/", dirname), http.StripPrefix(fmt.Sprintf("%s/", dirname), http.FileServer(http.Dir(fmt.Sprintf(".%s", dirname)))))
}
}

0 comments on commit 619de69

Please sign in to comment.