Mark Duppenthaler
Test docker
9a03fcf
raw
history blame contribute delete
616 Bytes
from flask import Flask, send_from_directory, jsonify, request
from flask_cors import CORS
import api
# Initialize the Flask app
app = Flask(__name__, static_folder="static")
CORS(app) # Enable CORS for all routes
# Register API routes
app.register_blueprint(api.bp)
# Serve the React app
@app.route("/", defaults={"path": ""})
@app.route("/<path:path>")
def serve(path):
if path and path.split("/")[-1].find(".") != -1:
return send_from_directory("static", path)
return send_from_directory("static", "index.html")
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000, debug=True)