1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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",
"http://localhost:8100",
"https://easybistro-office.web.app",
"https://easybistro-owner-manager.web.app",
]
app.add_middleware(
CORSMiddleware,
allow_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"])