|
from fastapi import FastAPI |
|
from fastapi.middleware.cors import CORSMiddleware |
|
from core.database import engine |
|
from core.models.appointment import Appointment |
|
from core.models.user import User |
|
from routes import appointments, users |
|
|
|
|
|
app = FastAPI() |
|
|
|
@app.get("/") |
|
def health_check(): |
|
return {"message": "π API is up and running!"} |
|
|
|
|
|
app.add_middleware( |
|
CORSMiddleware, |
|
allow_origins=["http://localhost:3000"], |
|
allow_credentials=True, |
|
allow_methods=["*"], |
|
allow_headers=["*"], |
|
) |
|
|
|
|
|
Appointment.__table__.create(bind=engine, checkfirst=True) |
|
User.__table__.create(bind=engine, checkfirst=True) |
|
|
|
|
|
app.include_router(appointments.router) |
|
app.include_router(users.router) |
|
|