Add app/main.py

This commit is contained in:
Cameron 2025-12-10 02:40:30 +00:00
parent 71e6130f96
commit 883656b1a4

27
app/main.py Normal file
View file

@ -0,0 +1,27 @@
from fastapi import FastAPI
from app import crud, schemas
from app.database import SessionLocal, engine
from app import models
# Create tables if not exist
models.Base.metadata.create_all(bind=engine)
app = FastAPI(title="Data Lab API")
@app.get("/")
def root():
return {"message": "Welcome to Data Lab API"}
@app.get("/customers")
def get_customers():
db = SessionLocal()
customers = crud.get_customers(db)
db.close()
return customers
@app.get("/accounts")
def get_accounts():
db = SessionLocal()
accounts = crud.get_accounts(db)
db.close()
return accounts