From 8c008bbb8e882d6e29c0f37f693b6f6848ab9fec Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Thu, 6 May 2021 13:35:55 +0200 Subject: [PATCH] changes --- openapi.yaml | 3 +++ server.ini | 6 ++++++ server.py | 14 +++++++++----- test.py | 8 ++++++++ 4 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 server.ini create mode 100644 test.py diff --git a/openapi.yaml b/openapi.yaml index 111b787..9d68e89 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -31,6 +31,9 @@ components: entry: description: Entry with timestamp and frequency type: object + required: + - timestamp + - frequency properties: timestamp: description: Synchronized timestamp in RFC3339 format in timezone UTC diff --git a/server.ini b/server.ini new file mode 100644 index 0000000..dc9b891 --- /dev/null +++ b/server.ini @@ -0,0 +1,6 @@ +[uwsgi] +http = :5000 +wsgi-file = server.py +processes = 4 +stats = :9191 + diff --git a/server.py b/server.py index af309e0..170b48b 100644 --- a/server.py +++ b/server.py @@ -1,8 +1,12 @@ import connexion -import logging +from flask_cors import CORS -logging.basicConfig(level=logging.INFO) +# instantiate the webservice +app = connexion.App(__name__) +app.add_api('openapi.yaml', options = {"swagger_ui": True}) -app = connexion.App('SinkConvert2') -app.add_api('./openapi.yaml') -app.run(port=8080) +# CORSify it - otherwise Angular won't accept it +CORS(app.app) + +# provide the webservice application to uwsgi +application = app.app diff --git a/test.py b/test.py new file mode 100644 index 0000000..af309e0 --- /dev/null +++ b/test.py @@ -0,0 +1,8 @@ +import connexion +import logging + +logging.basicConfig(level=logging.INFO) + +app = connexion.App('SinkConvert2') +app.add_api('./openapi.yaml') +app.run(port=8080)