views.py
This file
Path
examples/javascript/js_example/views.py
18 lines · 438 bytes · Python
Last changed by
Merge branch '2.1.x'David Lordbefore adoptiondcd1a1e
History of this fileTake it
The walk stopped after 200 commits: lines older than 8bfce88 point at it.
Minor docs fixes. (#3988)Joshua Bronsonbefore adoption8bfce88
lines 1–7why, one step back1from flask import jsonify2from flask import render_template3from flask import request45from js_example import app67Merge branch '2.1.x'David Lordbefore adoptiondcd1a1e
lines 8–9why, one step back8@app.route("/", defaults={"js": "fetch"})9@app.route("/<any(xhr, jquery, fetch):js>")Minor docs fixes. (#3988)Joshua Bronsonbefore adoption8bfce88
lines 10–18why, one step back10def index(js):11 return render_template(f"{js}.html", js=js)121314@app.route("/add", methods=["POST"])15def add():16 a = request.form.get("a", 0, type=float)17 b = request.form.get("b", 0, type=float)18 return jsonify(result=a + b)