from app import app
from app.utils.filters.markdown import md
from flask import request, abort
from werkzeug.exceptions import BadRequestKeyError

class API():
    @app.route("/api/markdown", methods=["POST"])
    def api_markdown():
        try:
            markdown = request.get_json()['text']
        except BadRequestKeyError:
            return "Dummy value"
            abort(400)
        return str(md(markdown))
