from flask import Flask from models import db from flask_migrate import Migrate from routes.userRoutes import userRoutes from routes.eventRoutes import eventRoutes import config from flask_jwt_extended import JWTManager class App: def __init__(self): self.app = Flask(__name__) self.set_config() self.set_up_db() self.set_up_jwt() self.register_blueprints() def set_config(self): self.app.config.from_object(config.Config) def set_up_db(self): db.init_app(self.app) self.migrate = Migrate(self.app, db) def set_up_jwt(self): self.jwt_manager = JWTManager(self.app) self.app.config['JWT_TOKEN_LOCATION'] = ['cookies'] self.app.config['JWT_COOKIE_NAME'] = 'access_token_cookie' def register_blueprints(self): self.app.register_blueprint(userRoutes, url_prefix='/user') self.app.register_blueprint(eventRoutes, url_prefix='/event') def run(self): with self.app.app_context(): db.create_all() self.app.run(debug=True) def print_endpoints(self): print("Endpoints and their functions:") for rule in self.app.url_map.iter_rules(): print(f"Endpoint: {rule.endpoint}, Path: {rule}") function_name = self.app.view_functions[rule.endpoint].__name__ print(f" Function: {function_name}") if __name__ == '__main__': app_instance = App() app_instance.print_endpoints() app_instance.run()