27 lines
709 B
Python
27 lines
709 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.api import auth, scanner
|
|
from app.db.database import engine, Base
|
|
|
|
# Initialize the database tables
|
|
Base.metadata.create_all(bind=engine)
|
|
|
|
app = FastAPI(title="Stock Scanner Pro API")
|
|
|
|
# Configure CORS for frontend access
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Include Routers
|
|
app.include_router(auth.router, prefix="/api/auth", tags=["auth"])
|
|
app.include_router(scanner.router, prefix="/api/scanner", tags=["scanner"])
|
|
|
|
@app.get("/")
|
|
def read_root():
|
|
return {"message": "Stock Scanner Backend is running."}
|