Add flask_cors and CORS object for managing cross origin access

This commit is contained in:
Koa Wells 2023-10-06 19:29:12 -04:00
parent ab4745bca9
commit 5dba0fa97c
2 changed files with 4 additions and 1 deletions

View File

@ -13,6 +13,7 @@ from pathlib import Path
from flasgger import LazyJSONEncoder, Swagger from flasgger import LazyJSONEncoder, Swagger
from flask import Response from flask import Response
from flask_restful import Api from flask_restful import Api
from flask_cors import CORS
import threading import threading
import hub_api.helpers.session_helper as sh import hub_api.helpers.session_helper as sh
@ -28,8 +29,9 @@ from hub_api.energy_plus.idf_generator import IdfGenerator
sh.begin_time = datetime.datetime.now() sh.begin_time = datetime.datetime.now()
app = flask.Flask('cerc_api') app = flask.Flask('cerc_api')
app.json_provider_class = LazyJSONEncoder app.json_provider_class = LazyJSONEncoder
api = Api(app)
api = Api(app)
CORS(app)
api.add_resource(Uptime, '/v1.4/uptime') api.add_resource(Uptime, '/v1.4/uptime')
# Session # Session

View File

@ -1,6 +1,7 @@
flask flask
flask_restful>0.3.8 flask_restful>0.3.8
flask-apispec flask-apispec
flask_cors
marshmallow marshmallow
apispec apispec
geomeppy geomeppy