const { app, BrowserWindow } = require('electron'); const { fork } = require('child_process'); const path = require('path'); let win; let backend; function startBackend() { backend = fork(path.join(__dirname, 'server.js')); } function createWindow() { win = new BrowserWindow({ width: 1200, height: 800, webPreferences: { nodeIntegration: false, contextIsolation: true, } }); win.setMenu(null); win.loadURL('http://localhost:3000'); } app.whenReady().then(() => { startBackend(); createWindow(); }); app.on('window-all-closed', () => { if (backend) backend.kill(); app.quit(); });