phi/src/phi/app.py

25 lines
478 B
Python

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)
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"),
)