|
from flask import Flask, request |
|
from app import judge, judgePlus |
|
from flask_cors import CORS |
|
import threading |
|
|
|
app = Flask(__name__) |
|
CORS(app) |
|
|
|
@app.route("/") |
|
def hello(): |
|
return {"hello":"Deploy success"} |
|
|
|
@app.route("/test") |
|
def test(): |
|
return "Test success" |
|
|
|
@app.route("/test/<text>") |
|
def returnText(text): |
|
return f'The text is {text}' |
|
|
|
@app.route("/check", methods=["POST"]) |
|
def check(): |
|
comment = request.json['comment'] |
|
result = judge(comment) |
|
return result |
|
|
|
@app.route("/checkplus", methods=["POST"]) |
|
def checkPlus(): |
|
comment = request.json['comment'] |
|
result = judgePlus(comment) |
|
return result |
|
|
|
if __name__ == '__main__': |
|
|
|
app.run(debug=True, threaded=True) |