diff --git a/endorsement.py b/endorsement.py index 2555599..87f8d0a 100644 --- a/endorsement.py +++ b/endorsement.py @@ -1,4 +1,14 @@ from app import app, db -from models import User +from models import User, Achievement +import json -print(User.query.all()) \ No newline at end of file +@app.route("/users/") +def get_user(username): + user = User.query.filter_by(username=username).first() + if not user: + return "{}" + return json.dumps(user.to_obj()) + +@app.route("/users/") +def all_users(): + return json.dumps([user.to_obj() for user in User.query.all()]) \ No newline at end of file