mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-Nonebot.git
synced 2026-07-03 15:41:27 +00:00
feat(backend): added ping
This commit is contained in:
parent
a7274b84b3
commit
e765a4129f
1 changed files with 5 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
from flask import Flask
|
from flask import Flask, jsonify
|
||||||
from src.clover_sqlite.models.questions import Question
|
from src.clover_sqlite.models.questions import Question
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
@ -17,6 +17,10 @@ async def init_data():
|
||||||
|
|
||||||
return "failed"
|
return "failed"
|
||||||
|
|
||||||
|
@app.route("/ping", methods=["GET"])
|
||||||
|
def ping():
|
||||||
|
return jsonify({"status": "ok", "message": "pong"}), 200
|
||||||
|
|
||||||
def start_flask():
|
def start_flask():
|
||||||
print("Flask启动中...")
|
print("Flask启动中...")
|
||||||
app.run(host='0.0.0.0', port=5001, debug=False, use_reloader=False)
|
app.run(host='0.0.0.0', port=5001, debug=False, use_reloader=False)
|
||||||
Loading…
Reference in a new issue