#!/usr/bin/python3

from flask import Flask
from api.v1.views import app_views
from flask_cors import CORS
import json

app = Flask(__name__)
app.url_map.strict_slashes = False
app.register_blueprint(app_views)
app.config['CORS_HEADERS'] = 'Content-Type'
cors = CORS(app, resources={r"/api/v1/.*": {"origins": "*"}})

@app.errorhandler(404)
def not_found(message):
     """
     For handling with the 404 error
     """
     resp = json.dumps({"error": "It doesn't exist here"})
     return resp, 404

if __name__ == '__main__':
     app.run(host='0.0.0.0', port='5000', threaded=True)
