import uvicorn
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from routes import doc, api
from fastapi.templating import Jinja2Templates
from starlette.requests import Request


# configure static and templates file on jinja 2
app = FastAPI(
    title=f"Technical Case",
    description=f"endpoint para subir planilhas para banco de dados relacional Postgres.",
    version=f"0.0.1",
    static_directory="static"
)
app.mount("/static", StaticFiles(directory="static"), name="static")

#import factory builders and initiate
doc.init_app(app)
api.init_app(app, "/api")

#
templates = Jinja2Templates(directory="templates")
#views
@app.get("/", tags=["/view"])
async def index(request: Request):
    return templates.TemplateResponse("index.html", {"request": request})

if __name__ == "__main__":
    uvicorn.run("main:app", host="0.0.0.0", port=8080)

[((258, 431), 'fastapi.FastAPI', 'FastAPI', ([], {'title': 'f"""Technical Case"""', 'description': 'f"""endpoint para subir planilhas para banco de dados relacional Postgres."""', 'version': 'f"""0.0.1"""', 'static_directory': '"""static"""'}), "(title=f'Technical Case', description=\n    f'endpoint para subir planilhas para banco de dados relacional Postgres.',\n    version=f'0.0.1', static_directory='static')\n", (265, 431), False, 'from fastapi import FastAPI\n'), ((549, 566), 'routes.doc.init_app', 'doc.init_app', (['app'], {}), '(app)\n', (561, 566), False, 'from routes import doc, api\n'), ((567, 592), 'routes.api.init_app', 'api.init_app', (['app', '"""/api"""'], {}), "(app, '/api')\n", (579, 592), False, 'from routes import doc, api\n'), ((608, 646), 'fastapi.templating.Jinja2Templates', 'Jinja2Templates', ([], {'directory': '"""templates"""'}), "(directory='templates')\n", (623, 646), False, 'from fastapi.templating import Jinja2Templates\n'), ((462, 493), 'fastapi.staticfiles.StaticFiles', 'StaticFiles', ([], {'directory': '"""static"""'}), "(directory='static')\n", (473, 493), False, 'from fastapi.staticfiles import StaticFiles\n'), ((825, 875), 'uvicorn.run', 'uvicorn.run', (['"""main:app"""'], {'host': '"""0.0.0.0"""', 'port': '(8080)'}), "('main:app', host='0.0.0.0', port=8080)\n", (836, 875), False, 'import uvicorn\n')]