mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-18 16:39:13 +00:00
add CORS
This commit is contained in:
parent
07e723dec8
commit
c6a3588e33
|
@ -8,6 +8,7 @@ from flask import Flask, request, jsonify
|
||||||
from flask_restful import Api
|
from flask_restful import Api
|
||||||
from flask_swagger import swagger
|
from flask_swagger import swagger
|
||||||
from flask_swagger_ui import get_swaggerui_blueprint
|
from flask_swagger_ui import get_swaggerui_blueprint
|
||||||
|
from flask_cors import CORS
|
||||||
|
|
||||||
from strawberry.flask.views import AsyncGraphQLView
|
from strawberry.flask.views import AsyncGraphQLView
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ def create_app(test_config=None):
|
||||||
"""Initiate Flask app and bind routes"""
|
"""Initiate Flask app and bind routes"""
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
api = Api(app)
|
api = Api(app)
|
||||||
|
CORS(app)
|
||||||
|
|
||||||
if test_config is None:
|
if test_config is None:
|
||||||
app.config["ENABLE_SWAGGER"] = os.environ.get("ENABLE_SWAGGER", "0")
|
app.config["ENABLE_SWAGGER"] = os.environ.get("ENABLE_SWAGGER", "0")
|
||||||
|
|
|
@ -18,6 +18,7 @@ let
|
||||||
pylint
|
pylint
|
||||||
pydantic
|
pydantic
|
||||||
typing-extensions
|
typing-extensions
|
||||||
|
flask-cors
|
||||||
(buildPythonPackage rec {
|
(buildPythonPackage rec {
|
||||||
pname = "strawberry-graphql";
|
pname = "strawberry-graphql";
|
||||||
version = "0.114.5";
|
version = "0.114.5";
|
||||||
|
@ -34,6 +35,7 @@ let
|
||||||
pydantic
|
pydantic
|
||||||
pygments
|
pygments
|
||||||
poetry
|
poetry
|
||||||
|
flask-cors
|
||||||
];
|
];
|
||||||
src = fetchPypi {
|
src = fetchPypi {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
|
|
Loading…
Reference in a new issue