|
|
|
@ -1,8 +1,7 @@
|
|
|
|
|
from flask import redirect, url_for
|
|
|
|
|
from flask import redirect, url_for, Blueprint
|
|
|
|
|
from flask_restx import apidoc
|
|
|
|
|
from . import v1 as APIv1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def register(app, web_api_root):
|
|
|
|
|
|
|
|
|
|
APIv1.app = app
|
|
|
|
@ -12,9 +11,11 @@ def register(app, web_api_root):
|
|
|
|
|
app.register_blueprint(APIv1.blueprint, url_prefix=f'{web_api_root}/v{int(APIv1.VERSION)}')
|
|
|
|
|
|
|
|
|
|
# add redirect to current api version
|
|
|
|
|
@app.route(f'{web_api_root}/')
|
|
|
|
|
redirect_api = Blueprint('redirect_api', __name__)
|
|
|
|
|
@redirect_api.route('/')
|
|
|
|
|
def redir():
|
|
|
|
|
return redirect(url_for(f'{APIv1.blueprint.name}.root'))
|
|
|
|
|
app.register_blueprint(redirect_api, url_prefix=f'{web_api_root}')
|
|
|
|
|
|
|
|
|
|
# swagger ui config
|
|
|
|
|
app.config.SWAGGER_UI_DOC_EXPANSION = 'list'
|
|
|
|
|