Update the /api/v0/ route handling to use the flask_blueprints Blueprint class

Instead of setting up the routes inside a function we can now use a
BlueprintSkip class, which allows us to register them at different
routes (eg. /api/v0/ and /api/v1/) and override any routes that will be
replaced by the new API version.
This commit is contained in:
Brian C. Lane 2019-04-22 14:59:02 -07:00
parent 7071e62985
commit 6d50a5874e
2 changed files with 886 additions and 882 deletions

View File

@ -1,5 +1,5 @@
# #
# Copyright (C) 2017 Red Hat, Inc. # Copyright (C) 2017-2019 Red Hat, Inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -83,4 +83,5 @@ def v0_status():
def bad_request(error): def bad_request(error):
return jsonify(status=False, errors=[{ "id": HTTP_ERROR, "code": error.code, "msg": error.name }]), error.code return jsonify(status=False, errors=[{ "id": HTTP_ERROR, "code": error.code, "msg": error.name }]), error.code
v0_api(server) # Register the v0 API on /api/v0/
server.register_blueprint(v0_api, url_prefix="/api/v0/")

File diff suppressed because it is too large Load Diff