import sys sys.path.append('./lib') from flask import Flask, request, redirect from flask_cors import CORS from allFunctions import manageLogin, manageSign, manageUpdate, manageDel, manageGet app = Flask(__name__) CORS(app, resources=r'/*') # 测试 @app.route('/v1/') def base(): return 'Hello! Glad to serve you.' # 登录 @app.route('/v1/login', methods=['POST']) def login(): return manageLogin(request) # 注册 @app.route('/v1/sign', methods=['POST']) def sign(): return manageSign(request) # 修改 @app.route('/v1/update', methods=['POST']) def update(): return manageUpdate(request) # 获取 @app.route('/v1/get', methods=['POST']) def get(): return manageGet(request) # 删除 @app.route('/v1/del', methods=['POST']) def dele(): return manageDel(request) # 访问拦截器转发到根路由 @app.errorhandler(404) def miss(e): return redirect('/v1/') if __name__ == '__main__': app.run(host="0.0.0.0", debug=True, port="80")