sparkle/app/main.py

22 lines
590 B
Python
Raw Normal View History

from fastapi import FastAPI
2024-09-06 01:23:00 +00:00
from app.core.config import settings
from app.api.v1.routes import stock
from app.ws.routes import trades
app = FastAPI()
2024-09-06 01:23:00 +00:00
app.include_router(stock.router, prefix="/api/v1")
app.include_router(trades.router, prefix="/ws")
2024-09-06 01:23:00 +00:00
@app.on_event("startup")
async def startup_event():
# Code to run on app startup, e.g., connect to WebSocket
pass
2024-09-06 01:23:00 +00:00
@app.on_event("shutdown")
async def shutdown_event():
# Code to clean up on shutdown
pass
2024-09-06 01:23:00 +00:00
if __name__ == "__main__":
import uvicorn
uvicorn.run("app.main:app", host="0.0.0.0", port=8000, reload=True)