@@ -205,12 +205,13 @@ app.on('ready', () => {
205205 createWindow ( ) ;
206206 if ( ! isDev ) {
207207 /**
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 .
212212 */
213213 const express = require ( './src/server/server' ) ;
214+ const mockServer = require ( './src/server/mockServer.js' ) ;
214215 autoUpdater . checkForUpdates ( ) ;
215216 }
216217} ) ;
@@ -420,12 +421,6 @@ ipcMain.on('import-proto', (event) => {
420421 }
421422 importedProto = file ;
422423 protoParserFunc ( importedProto ) . then ( ( protoObj ) => {
423- // console.log(
424- // "finished with logic. about to send importedProto : ",
425- // importedProto,
426- // " and protoObj : ",
427- // protoObj
428- // );
429424 mainWindow . webContents . send ( 'proto-info' , importedProto , protoObj ) ;
430425 } ) ;
431426 } ) ;
@@ -492,11 +487,11 @@ ipcMain.on('openapiParserFunc-request', (event, data) => {
492487} ) ;
493488
494489//======================= MOCK SERVER =======================//
495- const { spawn } = require ( 'child_process' ) ;
490+ const { fork } = require ( 'child_process' ) ;
496491
497- // starts the mock server by spawning a Node child process
492+ // starts the mock server by forking a Node child process
498493ipcMain . on ( 'start-mock-server' , ( ) => {
499- mockServerProcess = spawn ( 'node' , [ './src/server/mockServer.js' ] ) ;
494+ mockServerProcess = fork ( 'node' , [ './src/server/mockServer.js' ] ) ;
500495 mockServerProcess . on ( 'error' , ( err ) => {
501496 console . log ( 'Error starting mock server' , err ) ;
502497 } ) ;
0 commit comments