2025-06-30 20:33:39 +03:00

37 lines
1.1 KiB
Python

import eventlet
eventlet.monkey_patch()
from flask_cors import CORS
from pymongo import MongoClient
from flask_jwt_extended import JWTManager
from config import Config
from singletons.database_singleton import DatabaseSingleton
from infra.server import app, socketio
from controllers.user_controller import user_blueprint
from controllers.reservation_controller import reservation_blueprint
from controllers.health_controller import health_blueprint
from controllers.room_controller import room_blueprint
CORS(app)
app.config['JWT_SECRET_KEY'] = Config.JWT_SECRET_KEY
app.register_blueprint(user_blueprint, url_prefix='/user')
app.register_blueprint(reservation_blueprint, url_prefix='/reservation')
app.register_blueprint(room_blueprint, url_prefix='/room')
app.register_blueprint(health_blueprint, url_prefix='/health')
jwt = JWTManager(app)
client = MongoClient(Config.MONGO_URI)
db = DatabaseSingleton.get_instance()
if db is not None:
print('Connected to MongoDB')
else:
print('Failed to connect to MongoDB')
if __name__ == '__main__':
#app.run(debug=True)
socketio.run(app, host=Config.APP_HOST, debug=False)