20 lines
320 B
Go
20 lines
320 B
Go
package bond
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
func StaticDir(pth string) Handler {
|
|
return Wrap{
|
|
UseRelUrl: true,
|
|
HttpHandler: http.FileServer(http.Dir(pth)),
|
|
}
|
|
}
|
|
|
|
func StaticFile(pth string) Handler {
|
|
return Wrap{
|
|
HttpHandler: HttpHandlerFunc(func(w ResponseWriter, r *Request){
|
|
http.ServeFile(w, r, pth)
|
|
}),
|
|
}
|
|
}
|