15 lines
No EOL
354 B
Python
15 lines
No EOL
354 B
Python
from app import app
|
|
from models import User
|
|
|
|
import json
|
|
|
|
@app.route("/users/<username>")
|
|
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()]) |