balance-application/app.py

23 lines
525 B
Python
Raw Normal View History

2024-09-10 04:14:09 +00:00
from fastapi import FastAPI, Response
2024-09-10 05:20:11 +00:00
from routes.auth import router as auth
from routes.balance import router as balance
2024-09-10 12:20:03 +00:00
from fastapi.middleware.cors import CORSMiddleware
2024-09-10 01:31:17 +00:00
app = FastAPI()
2024-09-10 12:20:03 +00:00
app.add_middleware(
CORSMiddleware,
2024-09-10 12:22:01 +00:00
allow_origin=["*"],
allow_credentials=True,
2024-09-10 12:20:03 +00:00
allow_methods=["POST, GET, PATCH, DELETE"],
allow_headers=["*"]
)
2024-09-10 04:14:09 +00:00
@app.get("/")
def index(resp: Response):
resp.headers.setdefault("Content-Type", "text")
2024-09-10 01:31:17 +00:00
return "Hello, World!"
2024-09-10 05:20:11 +00:00
app.include_router(router=auth)
app.include_router(router=balance)