from app import app, db from models import User, Achievement import json @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()])