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, 'fastapi.FastAPI', 'FastAPI', False, 'from fastapi import FastAPI\n'), (19, 'routes.doc.init_app', 'doc.init_app', False, 'from routes import doc, api\n'), (20, 'routes.api.init_app', 'api.init_app', False, 'from routes import doc, api\n'), (23, 'fastapi.templating.Jinja2Templates', 'Jinja2Templates', False, 'from fastapi.templating import Jinja2Templates\n'), (16, 'fastapi.staticfiles.StaticFiles', 'StaticFiles', False, 'from fastapi.staticfiles import StaticFiles\n'), (30, 'uvicorn.run', 'uvicorn.run', False, 'import uvicorn\n')]