23 lines
425 B
Python
23 lines
425 B
Python
# -*- encoding: utf-8 -*-
|
|
from aiohttp import web
|
|
|
|
from phi.logging import get_logger
|
|
from phi.api.routes import api_routes
|
|
from phi.web.auth_middleware import authenticated
|
|
|
|
|
|
log = get_logger(__name__)
|
|
|
|
|
|
def api_app(store):
|
|
log.info("Initializing API sub-app.")
|
|
|
|
app = web.Application(middlewares=[authenticated])
|
|
|
|
app["store"] = store
|
|
app["log"] = log
|
|
|
|
app.router.add_routes(api_routes)
|
|
|
|
return app
|