Created
November 20, 2021 17:35
-
-
Save aguilard07/466a869598aa91f762498d1a5af1c7c5 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
@app.route("/user/<int:id>", methods=["GET"]) | |
def get_user_by_id(id): | |
user = User.query.filter_by(id=id).first() | |
if not user: | |
return jsonify({"message": "Not user found."}), 404 | |
else: | |
user_data = {} | |
user_data["id"] = user.id | |
user_data["username"] = user.username | |
user_data["admin"] = user.admin | |
return jsonify({"user": user_data}), 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment