The following strikes me as inelegant but it works. Is there a way to have flask-restful handle the two standard flavors of get (i.e. get everything and get one item) using the same resource class?
Thanks.
from flask_restful import Resource
# ...
class People(Resource):
def get(self):
return [{'name': 'John Doe'}, {'name': 'Mary Canary'}]
class Person(Resource):
def get(self, id):
return {'name': 'John Doe'}
# ...
api.add_resource(People, '/api/people')
api.add_resource(Person, '/api/people/<string:id>')