diff options
-rw-r--r-- | route.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/route.go b/route.go index b5c932d..768315e 100644 --- a/route.go +++ b/route.go @@ -5,11 +5,12 @@ import ( "strings" ) -type fn map[string]func(*Request) (Response, error) +type fn func(*Request) (Response, error) +type fns map[string]fn type Route struct { Path string - Executors fn + Executors fns Components []string RequiredNamedComponents map[string]bool OptionalNamedComponents map[string]bool @@ -74,7 +75,7 @@ func (self *Route) Execute(request *Request) (Response, error) { return code(request) } -func MakeRoute(path string, method string, code func(*Request) (Response, error)) Route { +func MakeRoute(path string, method string, code fn) Route { components := []string{} @@ -83,7 +84,7 @@ func MakeRoute(path string, method string, code func(*Request) (Response, error) } reqComponents, optComponents := getNamedComponents(components) - exec := fn{method: code} + exec := fns{method: code} route := Route{ Path: path, |