You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
415 B

from flask import jsonify, render_template, request
from js_example import app
@app.route('/', defaults={'js': 'plain'})
@app.route('/<any(plain, jquery, fetch):js>')
def index(js):
return render_template('{0}.html'.format(js), js=js)
@app.route('/add', methods=['POST'])
def add():
a = request.form.get('a', 0, type=float)
b = request.form.get('b', 0, type=float)
return jsonify(result=a + b)