Fix app.py
This commit is contained in:
parent
d4d7386bab
commit
025a8a74bc
@ -4,23 +4,6 @@ from db import db
|
|||||||
|
|
||||||
from models import User
|
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():
|
def create_app():
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
@ -32,6 +15,18 @@ def create_app():
|
|||||||
|
|
||||||
db.init_app(application)
|
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
|
return application
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user