Spaces:
Running
Running
File size: 670 Bytes
b8392c6 33c5eeb b8392c6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from fastapi import FastAPI
import threading
import uvicorn
from app.services.notification_service import notification_service
from app.services.firebase import * # Ensure Firebase is initialized
app = FastAPI()
@app.get("/")
def read_root():
return {"message": "Notification Service is running"}
def start_notification_service():
notification_service()
notif_thread = threading.Thread(target=start_notification_service, daemon=True)
notif_thread.start()
if __name__ == "__main__":
# Start notification service in a background thread
# Run FastAPI server in the main thread
uvicorn.run("app.main:app", host="0.0.0.0", port=8000, reload=False)
|