Commit 6b0cce2e authored by Robin Obůrka's avatar Robin Obůrka

Use v1 API as blueprint

parent 11bcf0dd
......@@ -6,4 +6,5 @@ app.config.from_object("certapi.default_settings")
app.config.from_pyfile("local.cfg", silent=True)
app.config.from_envvar("FLASK_APP_SETTINGS", silent=True)
import certapi.views
from certapi.views import apiv1
app.register_blueprint(apiv1, url_prefix="/v1")
import json
import redis
from flask import Blueprint
from flask import request
from flask import jsonify
from flask import g
......@@ -10,6 +12,9 @@ from certapi import app
from certapi.authentication import process_request
apiv1 = Blueprint("apiv1", __name__)
def get_redis():
r = g.get('redis', None)
if r is None:
......@@ -24,7 +29,7 @@ def log_debug_json(msg, msg_json):
current_app.logger.debug("%s:\n%s", msg, json.dumps(msg_json, indent=2))
@app.route("/v1", methods=['POST'])
@apiv1.route("", methods=['POST'])
def request_view():
# is class bytes
req_json = request.get_json() # class dict
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment