Init?
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
from flask import Flask, render_template, request, jsonify, url_for
|
||||
from .controller import Controller
|
||||
|
||||
|
||||
app = Flask(
|
||||
__name__,
|
||||
static_folder="./frontend/dist",
|
||||
static_url_path="/",
|
||||
template_folder="./frontend/dist",
|
||||
)
|
||||
controller = Controller()
|
||||
|
||||
|
||||
@app.route("/api/connect")
|
||||
def connect():
|
||||
host: str = request.args.get("host", "0.0.0.0")
|
||||
port: int = int(request.args.get("port", 5800))
|
||||
controller.connect(host, port)
|
||||
|
||||
|
||||
@app.route("/api/soundfonts")
|
||||
def soundfonts():
|
||||
return jsonify(controller.get_soundfonts())
|
||||
|
||||
|
||||
@app.route("/api/instruments")
|
||||
def instruments():
|
||||
font: int = int(request.args.get("font", 0))
|
||||
return jsonify(controller.get_instruments(font))
|
||||
|
||||
|
||||
@app.route("/", defaults={"path": ""})
|
||||
@app.route("/<path:path>")
|
||||
def index(path: str):
|
||||
return render_template("index.html")
|
||||
Reference in New Issue
Block a user