Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start an Express app using PM2.
Express
pm2 [1] app.js Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' or 'launch' instead of 'start' causes PM2 to fail.
✗ Incorrect
Use pm2 start to launch your app with PM2.
2fill in blank
mediumComplete the code to list all running processes managed by PM2.
Express
pm2 [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'show' or 'info' does not list all processes.
✗ Incorrect
pm2 list shows all running processes managed by PM2.
3fill in blank
hardFix the error in the command to restart a process named 'server'.
Express
pm2 [1] server Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'reload' or 'reset' does not restart the process correctly.
✗ Incorrect
Use pm2 restart to restart a process by name.
4fill in blank
hardFill both blanks to stop and delete a process with id 3.
Express
pm2 [1] 3 && pm2 [2] 3
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'kill' or 'remove' instead of 'stop' or 'delete' causes errors.
✗ Incorrect
First stop the process with pm2 stop, then remove it with pm2 delete.
5fill in blank
hardFill all three blanks to save the current PM2 process list and configure it to start on boot.
Express
pm2 [1] && pm2 [2] && pm2 [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up 'list' or missing 'save' causes processes not to restart on boot.
✗ Incorrect
Use pm2 save to save the process list, pm2 startup to generate startup script, and pm2 save again to persist the list for boot.