| 12345678910111213141516171819202122232425262728293031323334353637 |
- import logging
- from quart_cors import cors
- from quart import Quart
- from app.core.bootstrap import AppContext
- from app.core.dependency import ServerContainer
- from app.api.v1.routes import server_routes
- logging.basicConfig(level=logging.INFO)
- app = Quart(__name__)
- app = cors(app, allow_origin="*")
- server_container = ServerContainer()
- ctx = AppContext(server_container)
- config = server_container.config()
- log_service = server_container.log_service()
- mysql_manager = server_container.mysql_manager()
- routes = server_routes(mysql_manager, log_service, config)
- app.register_blueprint(routes)
- @app.before_serving
- async def startup():
- logging.info("Starting application...")
- await ctx.start_up()
- logging.info("Application started successfully")
- @app.after_serving
- async def shutdown():
- logging.info("Shutting down application...")
- await ctx.shutdown()
- logging.info("Application shutdown successfully")
|