Skip to content

Commit 335d37b

Browse files
committed
live-demo: add debug logs to the live-demo build
1 parent 9a3daa9 commit 335d37b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

live-demo/app/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,15 @@ async function seedDatabase() {
152152

153153
if (import.meta.url === `file://${process.argv[1]}`) {
154154
// if script is executed directly e.g. node index.ts or npm start
155+
console.log('Starting app...', new Date().toLocaleTimeString());
155156
const app = express()
156157
app.use(express.json());
157158
const port = 3500;
158159

159160
// needed to compile SPA. Call it here or from a build script e.g. in Docker build time to reduce downtime
161+
console.log('Check if we need to bundle AdminForth...', new Date().toLocaleTimeString());
160162
if (process.env.NODE_ENV === 'development') {
163+
console.log('Bundling AdminForth, please wait...', new Date().toLocaleTimeString());
161164
await admin.bundleNow({ hotReload: true});
162165
console.log('Bundling AdminForth done');
163166
}
@@ -272,10 +275,12 @@ if (import.meta.url === `file://${process.argv[1]}`) {
272275
)
273276
);
274277

275-
278+
console.log('Discovering databases and seeding data if needed, please wait...', new Date().toLocaleTimeString());
276279
// serve after you added all api
277280
admin.express.serve(app)
281+
console.log('AdminForth middleware added to express app', new Date().toLocaleTimeString());
278282
admin.discoverDatabases().then(async () => {
283+
console.log('Database discovered', new Date().toLocaleTimeString());
279284
//
280285
// !!! IMPORTANT !!!
281286
// NEVER COMMIT ANY COMMANDS TO INSERT USER WITH superadmin ROLE HERE!!!
@@ -297,9 +302,10 @@ if (import.meta.url === `file://${process.argv[1]}`) {
297302
}
298303

299304
await seedDatabase();
305+
console.log('Database seeding done, starting server...', new Date().toLocaleTimeString());
300306
});
301307

302-
308+
console.log('Starting express server...', new Date().toLocaleTimeString());
303309
admin.express.listen(port, () => {
304310
console.log(`Example app listening at http://localhost:${port}`)
305311
console.log(`\n⚡ AdminForth is available at http://localhost:${port}${ADMIN_BASE_URL}\n`)

0 commit comments

Comments
 (0)