Files
graphs/backend/index.js
Cauê Faleiros 1a430d4fb0
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m24s
Add native Olist composition sync
2026-08-10 11:26:38 -03:00

22 lines
767 B
JavaScript

const { createApp } = require('./server');
const { initDB } = require('./db');
const { OLIST_SYNC_ENABLED, PORT } = require('./config');
const { scheduleOlistSync } = require('./services/olistService');
const start = async () => {
await initDB();
const app = createApp();
if (OLIST_SYNC_ENABLED) scheduleOlistSync();
app.listen(PORT, '0.0.0.0', () => {
console.log(`Nexstar Backend running at http://localhost:${PORT}`);
console.log(`Endpoint for n8n: POST http://localhost:${PORT}/api/data`);
console.log(`Scheduled campaign processor: POST http://localhost:${PORT}/api/internal/process-stock-campaigns`);
});
};
start().catch((error) => {
console.error('Failed to start backend:', error);
process.exit(1);
});