@@ -205,12 +205,13 @@ app.on('ready', () => {
205
205
createWindow ( ) ;
206
206
if ( ! isDev ) {
207
207
/**
208
- * Note: Even though Express is not used for the duration of the block, this
209
- * is crucial code, and while VS Code will flag it as not being used, it
210
- * should not be removed. Express server is used in production mode as there
211
- * is no dev server .
208
+ * Note: Even though Express and mock server is not used for the duration of the block,
209
+ * this is crucial code, and while VS Code will flag it as not being used, it
210
+ * should not be removed. The servers must be required upon app startup (especially in
211
+ * packaged versions) or else the packaged app would not recognize the servers at all .
212
212
*/
213
213
const express = require ( './src/server/server' ) ;
214
+ const mockServer = require ( './src/server/mockServer.js' ) ;
214
215
autoUpdater . checkForUpdates ( ) ;
215
216
}
216
217
} ) ;
@@ -420,12 +421,6 @@ ipcMain.on('import-proto', (event) => {
420
421
}
421
422
importedProto = file ;
422
423
protoParserFunc ( importedProto ) . then ( ( protoObj ) => {
423
- // console.log(
424
- // "finished with logic. about to send importedProto : ",
425
- // importedProto,
426
- // " and protoObj : ",
427
- // protoObj
428
- // );
429
424
mainWindow . webContents . send ( 'proto-info' , importedProto , protoObj ) ;
430
425
} ) ;
431
426
} ) ;
@@ -492,11 +487,11 @@ ipcMain.on('openapiParserFunc-request', (event, data) => {
492
487
} ) ;
493
488
494
489
//======================= MOCK SERVER =======================//
495
- const { spawn } = require ( 'child_process' ) ;
490
+ const { fork } = require ( 'child_process' ) ;
496
491
497
- // starts the mock server by spawning a Node child process
492
+ // starts the mock server by forking a Node child process
498
493
ipcMain . on ( 'start-mock-server' , ( ) => {
499
- mockServerProcess = spawn ( 'node' , [ './src/server/mockServer.js' ] ) ;
494
+ mockServerProcess = fork ( 'node' , [ './src/server/mockServer.js' ] ) ;
500
495
mockServerProcess . on ( 'error' , ( err ) => {
501
496
console . log ( 'Error starting mock server' , err ) ;
502
497
} ) ;
0 commit comments