serve basic game data
This commit is contained in:
parent
e1f97d9cab
commit
e378697974
2 changed files with 9 additions and 1 deletions
|
@ -11,6 +11,14 @@ from websockets.socket import new_game_notice
|
|||
|
||||
api_games = Blueprint('api_games', __name__, url_prefix='/api/games')
|
||||
|
||||
@api_games.route('/<game_id>', methods=['GET'])
|
||||
def get_room(game_id):
|
||||
print(game_id)
|
||||
game = Game.query.filter_by(id=game_id).first()
|
||||
response = game_schema.dumps(game)
|
||||
# join_game_notice(game_id)
|
||||
return jsonify(response)
|
||||
|
||||
@api_games.route('/', methods=['POST'])
|
||||
@jwt_required()
|
||||
def post_game():
|
||||
|
|
|
@ -77,7 +77,7 @@ class GameSchema(ma.ModelSchema):
|
|||
id = fields.Int()
|
||||
name = fields.Str()
|
||||
description = fields.Str()
|
||||
boardSize = fields.Int()
|
||||
board_size = fields.Int()
|
||||
player = fields.Nested(user_schema)
|
||||
|
||||
game_schema = GameSchema()
|
||||
|
|
Loading…
Reference in a new issue