from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from server.routes.scb_service import scb from server.routes.user import user from server.routes.shop import shop from server.routes.category import cat from server.routes.table import table from server.routes.menu import menu version = '1.2.0' app = FastAPI(docs_url="/api/docs", openapi_url="/api", title="Database REST API For Easy Bistro", version=version) origins = [ "http://localhost:8080", "https://easybistro-office.web.app", "https://easybistro-owner-manager.web.app", ] app.add_middleware( CORSMiddleware, allow_origins=origins, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) @app.get("/") def read_root(): return {"Project":"Easy Bistro", "Framework": "Fast API", "Interpreter":"Python", 'API Version': version} app.include_router(scb, prefix="/v1", tags=["SCB API"]) app.include_router(user, prefix="/api", tags=["Office User"]) app.include_router(shop, prefix="/api", tags=["Shop"]) app.include_router(cat, prefix="/api", tags=["Category"]) app.include_router(table, prefix="/api", tags=["Table"]) app.include_router(menu, prefix="/api", tags=["Menu"])