cara mengembalikan respons json dalam labu
from flask import jsonify
@app.route('/summary')
def summary():
d = make_summary()
return jsonify(d)
NA RACE
from flask import jsonify
@app.route('/summary')
def summary():
d = make_summary()
return jsonify(d)
@app.route('/_get_current_user')
def get_current_user():
return jsonify(
username=g.user.username,
email=g.user.email,
id=g.user.id
)
#to manage json data in a request you have to use the get_json request method.
@app.route("/route", methods=["POST"])
def route():
data = request.get_json()
# use data
return redirect("/")