views.py
This file
Path
examples/javascript/js_example/views.py
18 lines · 429 bytes · Python
Last changed by
use ruff linter and formatter (#5331)David Lordbefore adoption9a12f34
History of this fileTake it
The walk stopped after 200 commits: lines older than c2688e4 point at it.
Merge pull request #5040 from pallets/dependabot/github_actions/actions/cache-3.3.1David Lordbefore adoptionc2688e4
lines 1–4why, one step back1from flask import jsonify2from flask import render_template3from flask import request4use ruff linter and formatter (#5331)David Lordbefore adoption9a12f34
line 5why, one step back5from . import appMerge pull request #5040 from pallets/dependabot/github_actions/actions/cache-3.3.1David Lordbefore adoptionc2688e4
lines 6–18why, one step back678@app.route("/", defaults={"js": "fetch"})9@app.route("/<any(xhr, jquery, fetch):js>")10def 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)