~callum/http-string-store

6c98dd9650ecc18c2fb11dbdf154e8ce191a2e34 — Callum Brown 3 years ago 798e1cb main
Add option to use CORS
2 files changed, 5 insertions(+), 0 deletions(-)

M README.md
M server.py
M README.md => README.md +1 -0
@@ 36,6 36,7 @@ Requirements:

- Python 3
- flask
- flask-cors (optional, CORS can be disabled by editing server.py)

Clone the repository and change to it's directory.


M server.py => server.py +4 -0
@@ 8,6 8,7 @@ from flask import Flask, g, request, abort, make_response
ID_LENGTH = 8
ID_CHARACTERS = string.ascii_letters + string.digits
STRING_MAX_BYTES = 1024
USE_CORS = True # requires flask-cors to be installed
DB_PATH = os.path.dirname(os.path.abspath(__file__)) + "/string_store.db"




@@ 52,6 53,9 @@ def response(s):


app = Flask(__name__)
if USE_CORS:
    from flask_cors import CORS
    CORS(app)
app.teardown_appcontext(close_db)