Added ServeStatic() method. GetURLParams now returns parameter itself, and renamed to GetURLParam.
This commit is contained in:
parent
8341fba20f
commit
5f9485fe3c
@ -49,9 +49,13 @@ func (s *HttpServer) DELETE(path string, handler http.HandlerFunc) {
|
|||||||
s.router.Handler(http.MethodDelete, path, handler)
|
s.router.Handler(http.MethodDelete, path, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetURLParams wrapper around underlying router for getting URL parameters.
|
func (s *HttpServer) ServeStatic(path string, fsys http.FileSystem) {
|
||||||
func GetURLParams(r *http.Request) httprouter.Params {
|
s.router.ServeFiles(path, fsys)
|
||||||
return httprouter.ParamsFromContext(r.Context())
|
}
|
||||||
|
|
||||||
|
// GetURLParam wrapper around underlying router for getting URL parameters.
|
||||||
|
func GetURLParam(r *http.Request, param string) string {
|
||||||
|
return httprouter.ParamsFromContext(r.Context()).ByName(param)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *HttpServer) Start(network, address string) error {
|
func (s *HttpServer) Start(network, address string) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user