<aside> 💡 PM2 Overall Commands and Code implementation

</aside>

🧩 1. Process Management – 8

<aside> 1️⃣ Use Case 🔹 Command: pm2 start

</aside>

What it does:

The launches an application under PM2’s process management.

pm2 start app.js

<aside> 2️⃣ Use Case 🔹 Command: pm2 restart

</aside>

What it does:

Restarts an already running application. If it’s not running, PM2 will throw an error.

Usage Examples:

You’ve made code changes and want to apply them without stopping the app permanently.

pm2 restart app.js

<aside> 3️⃣ Use Case 🔹 Command: pm2 reload

</aside>

What it does:

Reloads the app without downtime using a zero-downtime restart (for [“CLUSTER”](https://pm2.keymetrics.io/docs/usage/cluster-mode/#:~:text=The cluster mode allows networked,the number of CPUs available.) mode only). In fork mode, it behaves like restart.

Use it when:

You want to hot reload your Node.js app smoothly with no request interruption.

pm2 reload app.js