Add all project files
This commit is contained in:
34
app/main.py
Normal file
34
app/main.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from fastapi import FastAPI
|
||||
from .database import engine
|
||||
from . import models
|
||||
from .routers import payment
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from config import load_config
|
||||
|
||||
|
||||
ApplicationConfig = load_config()
|
||||
|
||||
|
||||
models.Base.metadata.create_all(bind=engine)
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
# print(ApplicationConfig.origins)
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=ApplicationConfig.origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
|
||||
|
||||
app.include_router(payment.router, prefix="/api", tags=["payment"])
|
||||
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def read_root():
|
||||
return {"message": "Welcome to the HVAC Payment API"}
|
||||
Reference in New Issue
Block a user