phi/src/phi/app.py

23 lines
479 B
Python
Raw Normal View History

2017-12-16 23:03:03 +01:00
from asyncio import get_event_loop
from aiohttp import web
from phi.api.app import api_app
def setup_app(config):
loop = get_event_loop()
app = web.Application(loop=loop)
app['config'] = config
api = api_app(config)
2017-12-16 23:03:03 +01:00
app.add_subapp('/api', api)
return app
def run_app(app):
web.run_app(app,
host=app['config']['core']['listen'].get('host', '127.0.0.1'),
port=app['config']['core']['listen'].get('port', '8080'))