ss/handler.go
2023-12-07 13:22:11 +03:00

28 lines
462 B
Go

package bond
import (
"net/http"
)
type Request = http.Request
type ResponseWriter = http.ResponseWriter
type HandlerFunc = http.HandlerFunc
type Handler = http.Handler
type Server = http.Server
type Context struct {
R *Request
W ResponseWriter
}
type ContextFunc func(*Context)
func (fn ContextFunc) ServeHTTP(w ResponseWriter, r *Request) {
fn(&Context{
R: r,
W: w,
})
}
func Static(pth string) Handler {
return http.FileServer(http.Dir(pth))
}