예제 #1
0
def newArticle():
    data = request.get_json(silent=True)

    if (data is None or 'title' not in data or 'content' not in data):
        return jsonify({'status': 'error'})

    art = Article(title=data['title'], content=data['content'])
    art.add()

    retJson = {'title': art.title, 'content': art.content}

    return jsonify(retJson)