You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
516 B
Python
23 lines
516 B
Python
7 years ago
|
import os
|
||
|
import logging
|
||
|
|
||
|
from flask import Blueprint, jsonify
|
||
|
|
||
|
from project.api.models import User
|
||
|
|
||
|
|
||
|
users_blueprint = Blueprint('users', __name__)
|
||
|
|
||
|
LOGGER = logging.getLogger('gunicorn.error')
|
||
|
|
||
|
|
||
|
@users_blueprint.route('/users', methods=['GET'])
|
||
|
def get_all_users():
|
||
|
LOGGER.info('Hitting the "/users" route')
|
||
|
response_object = {
|
||
|
'status': 'success',
|
||
|
'users': [user.to_json() for user in User.query.all()],
|
||
|
'container_id': os.uname()[1]
|
||
|
}
|
||
|
return jsonify(response_object), 200
|