how to import flask restful using pip
pip install Flask-RESTful
how to import flask restful using pip
pip install Flask-RESTful
flask api
@app.route('/api/v1/users', methods=['GET'])
def get_users():
users = [ user.json() for user in User.query.all() ]
return jsonify({'users': users })
@app.route('/api/v1/users/<id>', methods=['GET'])
def get_user(id):
user = User.query.filter_by(id=id).first()
if user is None:
return jsonify({'message': 'User does not exists'}), 404
return jsonify({'user': user.json() })
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us