from flask import Flask from routes.index import index_blueprint from routes.get_user_accounts import get_user_accounts_blueprint from routes.single_check import single_check_blueprint from routes.add_account import add_account_blueprint from routes.delete_account import delete_account_blueprint from routes.login import login_blueprint from auth import requires_auth from lib.get_users import get_users app = Flask(__name__) users = get_users() # Routes without auth app.register_blueprint(index_blueprint) # Routes with basic auth app.register_blueprint(login_blueprint, url_prefix="/login") app.register_blueprint(get_user_accounts_blueprint, url_prefix="/getUserAccounts") app.register_blueprint(single_check_blueprint, url_prefix="/singleCheck") app.register_blueprint(add_account_blueprint, url_prefix="/addAccount") app.register_blueprint(delete_account_blueprint, url_prefix="/deleteAccount") # 404 handler @app.errorhandler(404) def not_found(error): return {"error": "Not found"}, 404 # 500 error handler @app.errorhandler(500) def server_error(error): return {"error": "Server error"}, 500 if __name__ == "__main__": app.run(debug=True)