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)
|
||||
}
|
||||
|
||||
// GetURLParams wrapper around underlying router for getting URL parameters.
|
||||
func GetURLParams(r *http.Request) httprouter.Params {
|
||||
return httprouter.ParamsFromContext(r.Context())
|
||||
func (s *HttpServer) ServeStatic(path string, fsys http.FileSystem) {
|
||||
s.router.ServeFiles(path, fsys)
|
||||
}
|
||||
|
||||
// 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 {
|
||||
|
Loading…
Reference in New Issue
Block a user