sanic/sanic/router.py
2016-05-25 21:52:42 -07:00

15 lines
292 B
Python

from .log import log
class Router():
routes = None
default = None
def __init__(self, default=None):
self.routes = {}
self.default=default
def add(self, route, handler):
self.routes[route] = handler
def get(self, uri):
return self.routes.get(uri.decode('utf-8'), self.default)