Описание изменений

This commit is contained in:
2025-03-20 12:06:03 +03:00
parent e0d60ff473
commit a98710c12c
17 changed files with 131 additions and 620 deletions

View File

@@ -20,9 +20,16 @@ const adminRoutes = require('./routes/admin');
const app = express();
// Указываем хост явно
app.set('host', '127.0.0.1');
app.set('port', process.env.PORT || 8000);
// Настройка CORS
app.use(cors({
origin: 'http://localhost:5173',
origin: [
'http://localhost:5173',
'http://127.0.0.1:5173' // Добавляем альтернативный origin
],
credentials: true,
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
allowedHeaders: ['Content-Type', 'Authorization', 'Cookie']

View File

@@ -65,10 +65,11 @@ app.get('/api/health', (req, res) => {
});
// Запуск сервера
app.listen(PORT, async () => {
const host = app.get('host');
app.listen(PORT, host, async () => {
try {
await initServices();
console.log('Server is running on port', PORT);
console.log(`Server is running on http://${host}:${PORT}`);
} catch (error) {
console.error('Error starting server:', error);
process.exit(1);

View File

@@ -68,6 +68,7 @@ class TelegramBotService {
} catch (error) {
logger.error(`Error sending welcome message to ${chatId}:`, error);
}
}
async handleVerificationCode(msg) {