@app.route('/submit/cpu', methods=['GET'])
def getCpu():
cpu = getServerMetrics()
resp = Response(json.dumps(cpu), mimetype='application/json')
resp.headers['Access-Control-Allow-Origin'] = '*'
resp.headers['Access-Control-Allow-Methods'] = 'GET,POST'
return resp
Add the request header
resp.headers['Access-Control-Allow-Origin'] = '*'
resp.headers['Access-Control-Allow-Methods'] = 'GET,POST'
json.dumps() Write the value to be returned in , As I am cpu, Back again resp that will do