Spaces:
Sleeping
Sleeping
File size: 616 Bytes
9a03fcf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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)
|