repository to manage all files for 1_2_oder_3 interaction game for Inf2/2 Interaktionen SoSe23 from Engert, Caliskan and Bachiri
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

router.py 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. from flask import Flask, jsonify, Response, request
  2. from game import Game
  3. app = Flask(__name__)
  4. my_game = Game()
  5. @app.route('/GETQUESTION', methods=['GET'])
  6. def get_question():
  7. question = my_game.get_question()
  8. return jsonify(question)
  9. ## USEFUL ?
  10. # @app.route('/connection', methods=['GET'])
  11. # def connection():
  12. # return Response(status=200)
  13. @app.route('/teamsize', methods=['POST'])
  14. def teamsize():
  15. team_size = request.json
  16. my_game.set_teamsize(team_size.get('teamsize'))
  17. return Response(status=200)
  18. @app.route('/scoreboard', methods=['GET'])
  19. def scoreboard():
  20. new_score = my_game.scoreboard
  21. return new_score
  22. @app.route('/check', methods=['GET'])
  23. def check():
  24. pass
  25. @app.route('/reset', methods=['GET'])
  26. def reset():
  27. my_game.reset_game()
  28. return Response(status=200)
  29. ## IDEA
  30. @app.route('/GETSCORES', methods=['POST'])
  31. def get_scores():
  32. pass
  33. def main():
  34. ## ASUS Router
  35. # app.run(host='192.168.50.79', port=5555, debug=True)
  36. ## Postman
  37. app.run(host='127.0.0.1', port=5555, debug=True)
  38. if __name__ == '__main__':
  39. main()