| 0 | 1 | | from flask import Flask, request |
| 0 | 2 | | from flask_injector import FlaskInjector |
| 0 | 3 | | from injector import Injector |
| 0 | 4 | | from dependencies import AppModule |
| 0 | 5 | | from service.minesweeper import MineSweeperService |
| | 6 | |
|
| 0 | 7 | | app = Flask(__name__) |
| 0 | 8 | | app.debug = True |
| 0 | 9 | | app.secret_key = "ABCDEFG" |
| | 10 | |
|
| | 11 | |
|
| 0 | 12 | | @app.route("/") |
| 0 | 13 | | def index(service: MineSweeperService): |
| 0 | 14 | | return str(service) |
| | 15 | |
|
| | 16 | |
|
| 0 | 17 | | @app.route("/click") |
| 0 | 18 | | def click(service: MineSweeperService): |
| 0 | 19 | | x = int(request.args.get("x")) |
| 0 | 20 | | y = int(request.args.get("y")) |
| 0 | 21 | | service.click(x, y) |
| 0 | 22 | | return str(service) |
| | 23 | |
|
| | 24 | |
|
| 0 | 25 | | FlaskInjector(app, injector=Injector([AppModule(app)])) |