from flask import Flask, jsonify
from flask_cors import CORS
from flask_restful import Api
# from flask_uploads import configure_uploads, patch_request_class
from marshmallow import ValidationError

from resources.mime_validation import Mimevalidation
from resources.pid_validation import PIDvalidation

app = Flask(__name__)
#app.config.from_object("default_config")
CORS(app)
#patch_request_class(app, 10 * 1024 * 1024)
#configure_uploads(app, IMAGE_SET)
api = Api(app)


@app.errorhandler(ValidationError)
def handle_marshmallow_validation(err):
    return jsonify(err.message), 400


# extra
api.add_resource(PIDvalidation, "/pidvalidation")
api.add_resource(Mimevalidation, "/mimevalidation")

if __name__ == "__main__":
    app.run(port=5000, debug=True)