teoha's picture
Migrated away business logic and replaced with fastpi+celery API endpoint
e953bef
raw
history blame contribute delete
398 Bytes
from fastapi import FastAPI
from celery import Celery
app = FastAPI()
BROKER_URL = 'redis://139.59.127.180:6379/0'
BACKEND_URL = 'redis://139.59.127.180:6379/0'
celery = Celery(
__name__,
broker=BROKER_URL,
backend=BACKEND_URL
)
@app.get("/")
async def root():
return {"message": "Hello World"}
@celery.task
def divide(x, y):
import time
time.sleep(5)
return x / y