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)

[((10, 6, 15, 1), 'fastapi.FastAPI', 'FastAPI', (), '', False, 'from fastapi import FastAPI\n'), ((19, 0, 19, 17), 'routes.doc.init_app', 'doc.init_app', ({(19, 13, 19, 16): 'app'}, {}), '(app)', False, 'from routes import doc, api\n'), ((20, 0, 20, 25), 'routes.api.init_app', 'api.init_app', ({(20, 13, 20, 16): 'app', (20, 18, 20, 24): '"""/api"""'}, {}), "(app, '/api')", False, 'from routes import doc, api\n'), ((23, 12, 23, 50), 'fastapi.templating.Jinja2Templates', 'Jinja2Templates', (), '', False, 'from fastapi.templating import Jinja2Templates\n'), ((16, 21, 16, 52), 'fastapi.staticfiles.StaticFiles', 'StaticFiles', (), '', False, 'from fastapi.staticfiles import StaticFiles\n'), ((30, 4, 30, 54), 'uvicorn.run', 'uvicorn.run', (), '', False, 'import uvicorn\n')]