Created
November 20, 2021 16:57
-
-
Save aguilard07/b3d36336d66e39483a5312297b705a2c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List users | |
@app.route("/user", methods=["GET"]) | |
def get_all_users(): | |
users = User.query.all() | |
output = [] | |
for user in users: | |
user_data = {} | |
user_data["id"] = user.id | |
user_data["username"] = user.username | |
user_data["admin"] = user.admin | |
output.append(user_data) | |
return jsonify({"users": output}), 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment