"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "docs/patterns/singlepageapplications.rst" between
flask-1.1.1.tar.gz and flask-1.1.2.tar.gz

About: Flask is a lightweight Python WSGI web application framework.

singlepageapplications.rst  (flask-1.1.1):singlepageapplications.rst  (flask-1.1.2)
skipping to change at line 13 skipping to change at line 13
Flask can be used to serve Single-Page Applications (SPA) by placing static Flask can be used to serve Single-Page Applications (SPA) by placing static
files produced by your frontend framework in a subfolder inside of your files produced by your frontend framework in a subfolder inside of your
project. You will also need to create a catch-all endpoint that routes all project. You will also need to create a catch-all endpoint that routes all
requests to your SPA. requests to your SPA.
The following example demonstrates how to serve an SPA along with an API:: The following example demonstrates how to serve an SPA along with an API::
from flask import Flask, jsonify from flask import Flask, jsonify
app = Flask(__name__, static_folder='app') app = Flask(__name__, static_folder='app', static_url_path="/app")
@app.route("/heartbeat") @app.route("/heartbeat")
def heartbeat(): def heartbeat():
return jsonify({"status": "healthy"}) return jsonify({"status": "healthy"})
@app.route('/', defaults={'path': ''}) @app.route('/', defaults={'path': ''})
@app.route('/<path:path>') @app.route('/<path:path>')
def catch_all(path): def catch_all(path):
return app.send_static_file("index.html") return app.send_static_file("index.html")
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)