fpt-chat / apis /create_app.py
duythduong's picture
chore: add more corebase
253280e
raw
history blame contribute delete
510 Bytes
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from .v1.configs.swagger_config import swagger_config
# Define create_app function.
# Avoid circular import by using this function
# to create FastAPI app instance.
def create_app():
app = FastAPI(**swagger_config)
# CORs handling
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
return app