diff --git a/z1/README.md b/z1/README.md index 92036a7..6366c18 100644 --- a/z1/README.md +++ b/z1/README.md @@ -38,3 +38,7 @@ http://[ip address you copied]:5000 - A default network is created by docker compose for communication between these services - A named volum ('redis_data') ensures Redis data persists across restarts. + +## Cross-Origin Resource Sharing (CORS) + +Since frount end (Apache) diff --git a/z1/backend/Dockerfile b/z1/backend/Dockerfile index 717a23c..be27c94 100644 --- a/z1/backend/Dockerfile +++ b/z1/backend/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /app COPY app.py /app/ -RUN pip install flask redis +RUN pip install flask redis flask-cors EXPOSE 5000 diff --git a/z1/backend/app.py b/z1/backend/app.py index da96927..dbfb451 100644 --- a/z1/backend/app.py +++ b/z1/backend/app.py @@ -1,9 +1,11 @@ from flask import Flask, jsonify +from flask_cors import CORS import redis app = Flask(__name__) +CORS(app) -# Connect to Redis (running in a separate container) +# Connect to Redis (running in a separate container and foldr) redis_client = redis.StrictRedis(host='redis', port=6379, decode_responses=True) @app.route('/counter', methods=['GET']) diff --git a/z1/web/index.html b/z1/web/index.html index 241da34..83fec2a 100644 --- a/z1/web/index.html +++ b/z1/web/index.html @@ -14,7 +14,7 @@