This commit is contained in:
DingZQ
2024-12-09 23:38:44 +08:00
parent 41e80212e1
commit 1e43cdb17a

13
main.py
View File

@@ -15,6 +15,7 @@ import asyncio
import threading
from multiprocessing import Value
from fastapi.middleware.cors import CORSMiddleware
import random
JUNCTION = 0
RESERVOIR = 1
@@ -1829,3 +1830,15 @@ async def get_json():
)
############################################################
# DingZQ, 2024-12-09, Add sample API to return real time data/simulation result
############################################################
@app.get("/getrealtimedata/")
async def get_realtimedata():
data = [random.randint(0, 100) for _ in range(100)]
return data
@app.get("/getsimulationresult/")
async def get_simulationresult():
data = [random.randint(0, 100) for _ in range(100)]
return data