from flask import Flask, request, jsonify
from flask_cors import CORS
import validator

app = Flask(__name__)
CORS(app)


@app.route('/validator', methods=['POST'])
def validate():
    if request.method == 'POST':
        raw_file = request.files['file']
        text_content = validator.process_file(raw_file)
        validation_result = validator.validate(text_content)
        return jsonify(validation_result)


app.run()
