endorsement/api.py

18 lines
459 B
Python
Raw Normal View History

2018-11-28 15:02:38 +01:00
from app import app, db
from models import User, Achievement
import json
@app.route("/api")
@app.route("/api/all")
def api_all():
return json.dumps([user.to_obj() for user in User.query.all()])
@app.route("/api/users")
def api_all_users():
return json.dumps([user.id for user in User.query.all()])
@app.route("/api/achievements")
def api_all_achievements():
return json.dumps([achievement.to_obj() for achievement in Achievement.query.all()])