import { DcRouter } from '../ts/index.js'; const devRouter = new DcRouter({ // SmartProxy routes for development/demo smartProxyConfig: { routes: [ { name: 'web-traffic', match: { ports: [18080], domains: ['example.com', '*.example.com'] }, action: { type: 'forward', targets: [{ host: 'localhost', port: 3001 }] }, }, { name: 'api-gateway', match: { ports: [18080], domains: ['api.example.com'], path: '/v1/*' }, action: { type: 'forward', targets: [{ host: 'localhost', port: 4000 }] }, }, { name: 'tls-passthrough', match: { ports: [18443], domains: ['secure.example.com'] }, action: { type: 'forward', targets: [{ host: 'localhost', port: 4443 }], tls: { mode: 'passthrough' }, }, }, ], }, // Disable cache/mongo for dev cacheConfig: { enabled: false }, }); console.log('Starting DcRouter in development mode...'); await devRouter.start(); // Graceful shutdown handlers const shutdown = async () => { console.log('\nShutting down...'); await devRouter.stop(); process.exit(0); }; process.on('SIGINT', shutdown); process.on('SIGTERM', shutdown); console.log('DcRouter dev server running. Press Ctrl+C to stop.');