0
0
Expressframework~20 mins

PM2 for process management in Express - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
PM2 Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What does PM2 do when you run pm2 start app.js?

When you use PM2 to start an Express app with pm2 start app.js, what is the main behavior PM2 provides?

AIt compiles the app code before running it.
BIt only runs the app once and stops monitoring it.
CIt runs the app and automatically restarts it if it crashes or stops.
DIt runs the app but disables all network connections.
Attempts:
2 left
💡 Hint

Think about what process managers do to keep apps running smoothly.

component_behavior
intermediate
2:00remaining
What is the output of pm2 list after starting two apps?

You started two Express apps with PM2: pm2 start app1.js and pm2 start app2.js. What will pm2 list show?

AAn error saying no apps are running.
BA table showing both apps with their status as online and their process IDs.
COnly the first app listed with status online.
DA list of all files in the current directory.
Attempts:
2 left
💡 Hint

PM2 keeps track of all running apps and shows their status.

📝 Syntax
advanced
2:00remaining
Which PM2 command syntax correctly restarts an app named server?

Choose the correct PM2 command to restart an app named server.

Apm2 reload-server
Bpm2 start --restart server
Cpm2 reset server
Dpm2 restart server
Attempts:
2 left
💡 Hint

Look for the PM2 command that explicitly restarts an app by name.

🔧 Debug
advanced
2:00remaining
Why does pm2 logs show no output after starting an app?

You started your Express app with PM2 using pm2 start app.js, but pm2 logs shows no output even when you make requests. What is a likely cause?

AThe app does not print anything to the console; logs are empty.
BPM2 logs command only shows errors, not normal output.
CPM2 was not installed correctly and cannot show logs.
DThe app crashed immediately and stopped logging.
Attempts:
2 left
💡 Hint

Think about what your app prints to the console and what PM2 captures.

lifecycle
expert
2:00remaining
What happens when you run pm2 save and then reboot the server?

After starting your Express app with PM2, you run pm2 save and then reboot your server. What is the expected behavior after reboot?

APM2 automatically restarts all saved apps on reboot without manual commands.
BPM2 forgets all apps and you must start them again manually.
CPM2 deletes the saved list and stops running after reboot.
DPM2 restarts apps but only if you run <code>pm2 resurrect</code> manually.
Attempts:
2 left
💡 Hint

Consider what pm2 save does and how PM2 integrates with system startup.