From 5d36a8e533f930774e6d3bc6dd9b7aa4a4f9cafb Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Wed, 19 May 2021 12:07:23 +0200 Subject: [PATCH] Moved url_prefix to bp mount instead of creation --- app/__main__.py | 4 ++-- app/api/__init__.py | 6 +++--- app/api/search.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/__main__.py b/app/__main__.py index 5e7f0af..0ae9974 100644 --- a/app/__main__.py +++ b/app/__main__.py @@ -1,9 +1,9 @@ """Entrypoint for the program.""" from quart import Quart -from app.api import blueprint +from app.api import api_bp app = Quart("jos", static_folder="web/dist", static_url_path="/") -app.register_blueprint(blueprint) +app.register_blueprint(api_bp, url_prefix="/api") @app.route("/", methods=["GET"], defaults={"path": ""}) diff --git a/app/api/__init__.py b/app/api/__init__.py index 036ab13..718ec88 100644 --- a/app/api/__init__.py +++ b/app/api/__init__.py @@ -1,8 +1,8 @@ """Module containing all Flask-related code.""" from quart import Blueprint -from .search import blueprint as search_blueprint +from .search import search_bp # Main blueprint exposing entire API -blueprint = Blueprint("api", __name__, url_prefix="/api") -blueprint.register_blueprint(search_blueprint) +api_bp = Blueprint("api", __name__) +api_bp.register_blueprint(search_bp, url_prefix="/search") diff --git a/app/api/search.py b/app/api/search.py index b1ca848..c0d32dc 100644 --- a/app/api/search.py +++ b/app/api/search.py @@ -2,10 +2,10 @@ from quart import Blueprint -blueprint = Blueprint("search", __name__, url_prefix="/search") +search_bp = Blueprint("search", __name__) -@blueprint.route("/", methods=["GET"]) +@search_bp.route("/", methods=["GET"]) async def search_spotify(): """Search the Spotify API.""" return "yeet"