Write the back-end interface using Python’s flash framework


After all, it’s time for me, a newcomer to the front end, to write the interface by myself, roll up my sleeves and directly write the code

import pymssql
import time
from flask import Flask, request, jsonify
from flask_cors import CORS

#Database connection
DB = pymssql.connect (host = 'own database address',
                     User = 'user name',
                     Password = 'password',
                     Database = 'database name')
cursor = db.cursor()

#Back end service startup
app = Flask(__name__)
CORS(app, resources=r'/*')

@app.route('/myGET', methods=['GET'])
def my_get():
    if request.method == "GET":
    #Business logic
#When the business is completed, remember to disconnect the database
if __name__ == "__main__":
    app.run(host='', port=8888)
    print("good bye")