server.py 734 B

12345678910111213141516171819202122232425262728293031
  1. from flask import Flask,request
  2. import mysql_search_utils
  3. app = Flask(__name__)
  4. @app.route('/hello')
  5. def helloWord():
  6. print(request.path)
  7. print(request.full_path)
  8. return 'hello world'
  9. @app.route('/getOne')
  10. def getJson():
  11. mysql = mysql_search_utils.mysqlSearchUtils()
  12. responseDict = {}
  13. data = mysql_search_utils.mysqlSearchUtils.get_one(mysql)
  14. responseDict["data"] = data
  15. return responseDict
  16. @app.route('/getList')
  17. def getList():
  18. mysql = mysql_search_utils.mysqlSearchUtils();
  19. responseDict = {}
  20. list = mysql_search_utils.mysqlSearchUtils.get_all(mysql)
  21. responseDict["list"] = list
  22. return responseDict
  23. if __name__ == '__main__':
  24. app.run(host='0.0.0.0',port=8079,debug=True)