0
0
Expressframework~5 mins

PM2 for process management in Express - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is PM2 in the context of Node.js applications?
PM2 is a process manager for Node.js applications that helps keep apps running continuously, restarts them if they crash, and manages multiple processes easily.
Click to reveal answer
beginner
How do you start an Express app using PM2?
You use the command pm2 start app.js where app.js is your Express app's main file. PM2 will run and monitor the app.
Click to reveal answer
beginner
What command shows the list of running processes managed by PM2?
The command pm2 list displays all running processes with their status, CPU, and memory usage.
Click to reveal answer
intermediate
How does PM2 help with zero-downtime reloads in production?
PM2 can reload your app without stopping it completely using pm2 reload app_name, which restarts processes one by one to avoid downtime.
Click to reveal answer
intermediate
What is the purpose of the ecosystem.config.js file in PM2?
It is a configuration file where you define how PM2 should run your app(s), including environment variables, number of instances, and script paths.
Click to reveal answer
Which PM2 command starts your Express app?
Apm2 start app.js
Bpm2 run app.js
Cpm2 execute app.js
Dpm2 launch app.js
What does pm2 list show?
AAll installed npm packages
BRunning processes managed by PM2
CSystem CPU usage
DNetwork connections
How can PM2 help avoid downtime when updating your app?
ABy disabling the app temporarily
BBy stopping all processes before restart
CBy running a backup server
DBy reloading processes one by one
What is the role of ecosystem.config.js in PM2?
AIt stores app logs
BIt is a database file
CIt defines app start settings and environment
DIt contains user credentials
Which of these is NOT a feature of PM2?
ACompiling JavaScript to machine code
BLoad balancing across CPU cores
CMonitoring CPU and memory usage
DAutomatic app restarts on crash
Explain how PM2 helps keep an Express app running smoothly in production.
Think about what happens if your app crashes or needs updating.
You got /4 concepts.
    Describe the purpose and typical contents of the PM2 ecosystem.config.js file.
    It's a setup file that tells PM2 how to run your app.
    You got /4 concepts.