I like to set this up outside of the git repo. If you don’t have python3.6 or later install it first. Setup virtual environment in a new terminal window. Here is the code for our very simple backend: import json from flask import Flask, request from flask_cors import CORS app = Flask(_name_) CORS(app) # NOTE: This route is needed for the default EB health check route def home(): return "ok" def get_topics(): return if _name_ = '_main_': app.run(port=8080) Now obviously our frontend is showing errors trying to load from the backend because the backend doesn’t exist and we never set the env var REACT_APP_API_URL. See here: You may need to install additional packages like so: npm install -save axios Next I added the code to make the requests to the backend.
0 Comments
Leave a Reply. |