agregado cors para recibir peticiones de otros endpoints distintos
This commit is contained in:
1
whatsapp-router/package-lock.json
generated
1
whatsapp-router/package-lock.json
generated
@@ -12,6 +12,7 @@
|
||||
"@google/genai": "^1.4.0",
|
||||
"@open-wa/wa-automate": "^4.76.0",
|
||||
"axios": "^1.5.0",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.5.0",
|
||||
"express": "^4.18.2",
|
||||
"ffmpeg-static": "^5.2.0",
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"@google/genai": "^1.4.0",
|
||||
"@open-wa/wa-automate": "^4.76.0",
|
||||
"axios": "^1.5.0",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.5.0",
|
||||
"express": "^4.18.2",
|
||||
"ffmpeg-static": "^5.2.0",
|
||||
|
||||
@@ -3,6 +3,7 @@ import dotenv from 'dotenv';
|
||||
import { registerConversationRoutes } from './routes/conversationActions';
|
||||
import whatsappActionsRouter from './routes/whatsappActions';
|
||||
import { registerLogSse } from './sse/logSse';
|
||||
import cors from 'cors';
|
||||
import {
|
||||
registerWebhookRoutes,
|
||||
clearWebhooks,
|
||||
@@ -38,8 +39,21 @@ if (
|
||||
}
|
||||
|
||||
const app = express();
|
||||
|
||||
|
||||
|
||||
app.use(cors({
|
||||
origin: 'http://localhost:5173',
|
||||
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
|
||||
credentials: true, // si usás cookies o headers personalizados
|
||||
}));
|
||||
|
||||
|
||||
app.use(express.json());
|
||||
|
||||
|
||||
|
||||
|
||||
registerLogSse(app);
|
||||
|
||||
const port = Number(process.env.PORT) || 3001;
|
||||
|
||||
Reference in New Issue
Block a user