Skip to content

Commit

Permalink
backend: Conditional improved
Browse files Browse the repository at this point in the history
  • Loading branch information
CSantosM committed Aug 12, 2024
1 parent 8024d04 commit abc5fce
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion openvidu-call-back/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,15 @@ const startServer = (app: express.Application) => {
});
};

if (import.meta.url === `file://${process.argv[1]}`) {
/**
* Determines if the current module is the main entry point of the application.
* @returns {boolean} True if this module is the main entry point, false otherwise.
*/
const isMainModule = (): boolean => {
return import.meta.url === `file://${process.argv[1]}`;
};

if (isMainModule()) {
const app = createApp();
startServer(app);
}
Expand Down

0 comments on commit abc5fce

Please sign in to comment.