18 lines
487 B
Python
18 lines
487 B
Python
from flask import Flask, jsonify
|
|
|
|
compiti = [{"id": 1, "descrizione": "Compito matematica"}, {"id": 2, "descrizione": "Consegna TPSIT progetto API REST"}]
|
|
|
|
app = Flask(__name__)
|
|
|
|
@app.route("/", methods=["GET"])
|
|
def home():
|
|
html = "<h1>Home page API REST Compiti</h1><h2>ciao, 3cx merda</h2>"
|
|
html += "<a href=\"/doc.html\">Documentazione</a>"
|
|
return html, 200
|
|
|
|
@app.route("/compiti", methods=["GET"])
|
|
def get_compiti():
|
|
return jsonify(compiti), 200
|
|
|
|
app.run(debug=True)
|