phi/src/phi/app.py

25 lines
478 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)
2020-11-20 12:04:17 +01:00
app["config"] = config
2017-12-16 23:03:03 +01:00
api = api_app(config)
2020-11-20 12:04:17 +01:00
app.add_subapp("/api", api)
2017-12-16 23:03:03 +01:00
return app
def run_app(app):
2020-11-20 12:04:17 +01:00
web.run_app(
app,
host=app["config"]["core"]["listen"].get("host", "127.0.0.1"),
port=app["config"]["core"]["listen"].get("port", "8080"),
)