Skip to content

Flask & APIs

The backend is a Flask application living in server/. The main app and routes are defined in server/app.py, and most business logic lives in per-endpoint handler modules under server/api_endpoints/.

Minimal API example (learning snippet)

This example shows a tiny Flask API with a health check and a prediction endpoint. It is meant as a learning reference and does not mirror the full Anote backend.

from flask import Flask, request, jsonify

app = Flask(__name__)

@app.get("/health")
def health():
    return {"ok": True}

@app.post("/predict")
def predict():
    payload = request.get_json(force=True)
    # TODO: call your model here
    return jsonify({"input": payload, "output": "label"})

Running the Flask server

Typical local dev runs on port 5000:

cd server
flask run