feat: add welcome page
This commit is contained in:
parent
f3a3b7a0cf
commit
8eee25500c
@ -36,6 +36,11 @@ def clean_env():
|
|||||||
clear_database()
|
clear_database()
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/")
|
||||||
|
async def home():
|
||||||
|
return {"message": "Hello, World!"}
|
||||||
|
|
||||||
|
|
||||||
@app.get("/server/show_nodes")
|
@app.get("/server/show_nodes")
|
||||||
async def show_nodes() -> list:
|
async def show_nodes() -> list:
|
||||||
nodes_list = []
|
nodes_list = []
|
||||||
@ -139,7 +144,7 @@ async def send_nodes_list(count: int) -> list:
|
|||||||
# 查询数据库中的节点数据
|
# 查询数据库中的节点数据
|
||||||
cursor = db.execute("SELECT * FROM nodes LIMIT ?", (count,))
|
cursor = db.execute("SELECT * FROM nodes LIMIT ?", (count,))
|
||||||
rows = cursor.fetchall()
|
rows = cursor.fetchall()
|
||||||
|
|
||||||
for row in rows:
|
for row in rows:
|
||||||
id, ip, last_heartbeat = row
|
id, ip, last_heartbeat = row
|
||||||
nodes_list.append(ip)
|
nodes_list.append(ip)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user