From 025a8a74bcc6313dad5ae31eecafc58f4dee124d Mon Sep 17 00:00:00 2001 From: H4CK3R-01 Date: Sun, 13 Mar 2022 20:50:58 +0100 Subject: [PATCH] Fix app.py --- webservice/app.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/webservice/app.py b/webservice/app.py index c7f51e6..704c5a2 100644 --- a/webservice/app.py +++ b/webservice/app.py @@ -4,23 +4,6 @@ from db import db from models import User -app = Flask(__name__) - - -@app.route('/') -def hello_world(): - return 'Hello World!' - - -@app.route('/users') -def users(): - res = [] - for i in User.query.all(): - res.append(i.to_dict(show='*')) - - return jsonify(res) - - def create_app(): load_dotenv() @@ -32,6 +15,18 @@ def create_app(): db.init_app(application) + @application.route('/') + def hello_world(): + return 'Hello World!' + + @application.route('/users') + def users(): + res = [] + for i in User.query.all(): + res.append(i.to_dict(show='*')) + + return jsonify(res) + return application