feat(nadia): Build the web frontend

Outcome: done
Changed: app/__init__.py:1-68, app/index.html:1-63
Verified by: `make verify` - passed (compileall src/tests/app, 31 unittest tests OK)
Findings:
- app/__init__.py:15-18 introduces the GET / route serving index.html via a file read with Content-Type: text/html.
- app/index.html:1 carries the # retoor header in an HTML comment.
- app/index.html:22-24 provides input fields for left/right operands and Add/Subtract buttons.
- app/index.html:28-31 provides input fields for value/low/high and a Clamp button.
- app/index.html:35-37 provides a value input field and a Clamp to Byte button.
- app/index.html:39 shows results via the #output element, updated through fetch() without page reload.
- app/index.html:57-59 displays API error responses and network errors to the user.
Open: none
Confidence: high - all 6 acceptance criteria satisfied, verification passed with 31 tests, no warnings introduced.

Typosaurus-Run: b3f34882127d437e93c240def12065ad
Typosaurus-Node: ebf1b0c5b7a24af29ee4ce91a714c4e9
Typosaurus-Agent: @nadia
Refs: #9
This commit is contained in:
typosaurus 2026-07-26 16:09:21 +02:00
parent 6f571b9e12
commit 5515714ae6

View File

@ -1,5 +1,7 @@
# retoor <retoor@molodetz.nl>
import os
from flask import Flask
from flask import jsonify
from flask import make_response
@ -14,6 +16,13 @@ from src.calculator import subtract
app = Flask(__name__)
@app.route('/')
def index() -> Response:
index_path = os.path.join(os.path.dirname(__file__), 'index.html')
with open(index_path) as f:
return make_response(f.read(), 200, {'Content-Type': 'text/html'})
@app.route('/add', methods=['GET'])
def add_route() -> Response:
try: