Refactor
This commit is contained in:
@@ -350,18 +350,15 @@ def main(ctx, program, expression):
|
|||||||
ctx.exit()
|
ctx.exit()
|
||||||
|
|
||||||
source = expression if program is None else program.read()
|
source = expression if program is None else program.read()
|
||||||
|
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
for ep, _, _ in KAPOW_PROGRAM.scanString(source):
|
for ep, _, _ in KAPOW_PROGRAM.scanString(source):
|
||||||
|
methods = ep.method.asList()[0].split('|')
|
||||||
|
pattern = ''.join(ep.urlpattern)
|
||||||
if ep.body:
|
if ep.body:
|
||||||
register_code_endpoint(app,
|
register_code_endpoint(app, methods, pattern, ep.body)
|
||||||
ep.method.asList()[0].split('|'),
|
|
||||||
''.join(ep.urlpattern),
|
|
||||||
ep.body)
|
|
||||||
else:
|
else:
|
||||||
register_path_endpoint(app,
|
register_path_endpoint(app, methods, pattern, ep.path)
|
||||||
ep.method.asList()[0].split('|'),
|
|
||||||
''.join(ep.urlpattern),
|
|
||||||
ep.path)
|
|
||||||
web.run_app(app)
|
web.run_app(app)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user