2024-01-10 20:11:02 +03:00
|
|
|
package bond
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
2024-01-10 21:19:23 +03:00
|
|
|
func StaticDir(pth string) Handler {
|
|
|
|
return Wrap{
|
|
|
|
UseRelUrl: true,
|
|
|
|
HttpHandler: http.FileServer(http.Dir(pth)),
|
|
|
|
}
|
2024-01-10 20:11:02 +03:00
|
|
|
}
|
|
|
|
|
2024-01-10 21:19:23 +03:00
|
|
|
func StaticFile(pth string) Handler {
|
|
|
|
return Wrap{
|
|
|
|
HttpHandler: HttpHandlerFunc(func(w ResponseWriter, r *Request){
|
|
|
|
http.ServeFile(w, r, pth)
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
}
|