Router¶
-
class
Router
¶ The decision maker that pairs in incoming request with a registered handler
-
routes
: table¶ List of Routes registered
-
route
(req, res)¶ Dispatch a request to the approparte Route
- Parameters
req (Request) –
res (Response) –
-
register_handler
(path, method, callback)¶ Register a single route
The callback this route will use to handle requests
- Parameters
path (str) – The route for this request
method (str) – the HTTP method for this request
callback (fun(Request, Response)) –
-