from flask import Flask, jsonify, request app = Flask(__name__) videos = [ {"id": 1, "title": "First Video", "url": "https://example.com/video1.mp4"}, {"id": 2, "title": "Second Video", "url": "https://example.com/video2.mp4"} ] @app.route('/videos', methods=['GET']) def get_videos(): return jsonify(videos) const App = () => { const [videos, setVideos] = useState([]); useEffect(() => { fetch('http://127.0.0.1:5000/videos') // Flask API URL .then(response => response.json()) .then(data => setVideos(data)); }, []); return ( Video List item.id.toString()} renderItem={({ item }) => ( {item.title} )} /> ); };
Comments
Post a Comment