Skip to content

Commit

Permalink
fix(api): move firebase data loading location
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao authored Jan 18, 2024
1 parent ee72f4a commit 12d37d4
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,21 @@ global.requestTracker = [];
await initializeAPI();
logger('info', JSON.stringify({ details: `API: minimum CPE client version set to ${global.minimumVersionCPE}` }));

await users.loadAll();
await congregations.loadAll();
await publicTalks.loadAll();

// dev initialize
if (process.env.NODE_ENV === 'development') {
await importPublicTalks();
}

app.listen(PORT, async () => {
logger('info', JSON.stringify({ details: `server up and running (v${APP_VERSION})` }));

logger('info', JSON.stringify({ details: `loading Firebase data ...` }));

await users.loadAll();
await congregations.loadAll();
await publicTalks.loadAll();

// dev initialize
if (process.env.NODE_ENV === 'development') {
await importPublicTalks();
}

logger('info', JSON.stringify({ details: `loading completed.` }));
});

export { app as api };

0 comments on commit 12d37d4

Please sign in to comment.