Started with web application

This commit is contained in:
cami 2021-08-28 23:42:33 +02:00
parent 7beda138c5
commit 75f2365024
40 changed files with 17382 additions and 0 deletions

30
backend/src/app.py Normal file
View file

@ -0,0 +1,30 @@
import os
import time
import flask
app = flask.Flask(__name__)
# Read environment variables
if "DEBUG" in os.environ and os.environ["DEBUG"] == 'yes':
debug = True
else:
debug = False
if "HOST" in os.environ:
host = os.environ["HOST"]
else:
host = '0.0.0.0'
if "PORT" in os.environ:
port = int(os.environ["PORT"])
else:
port = 5000
@app.route('/time')
def get_current_time():
return {'time': time.time()}
@app.route('/api/generate-letter', methods=['POST'])
def create_letter():
req = flask.request.get_json(force=True)
print(req)
ret = {'message': 'Erfolgreich'}
return ret, 200