Spaces:
Sleeping
Sleeping
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 | |
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) | |