StaticServer is a small Go Language library that provides a http.handler to serve static files in a folder. Unlike the default file server, StaticServer does not allow listing of directories - it allows access to files only with a direct URL
go get github.com/srinathh/staticserver
ss, err := staticserver.NewStaticServer("path/to/be/served")
if err != nil{
log.Fatal(err)
}
http.Handle("/mycustom/endpoint", mycustomhandler)
http.Handle("/",ss)
http.ListenAndServe(":8080",nil)
- Allow custom setting of file not found and bad request pages
- Setup handling of strip-prefix etc