Moved Routing from Server/Server.py to own file
This commit is contained in:
parent
19fd9d1962
commit
02715dd97f
1 changed files with 17 additions and 0 deletions
17
Shared/Routing.py
Normal file
17
Shared/Routing.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
class Route:
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
self.setup(**kwargs)
|
||||||
|
|
||||||
|
def setup(self, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def run(self, data, handler):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def create_routes(routes):
|
||||||
|
routes = routes.copy()
|
||||||
|
for prefix in routes:
|
||||||
|
if type(routes[prefix]) is tuple or type(routes[prefix]) is list:
|
||||||
|
routes[prefix] = routes[prefix][0](**routes[prefix][1])
|
||||||
|
return routes
|
Reference in a new issue