Keeps a process running unless stopped explicitely
• Keeps apps running continuously.
• Automatically restarts crashed apps.
• Provides monitoring and logging.
• Supports running multiple app instances for better performance.
npm i -g pm2
const express = require("express");
const app = express();
app.get("/", (req, res) => {
res.send("Hello, World!");
});
const PORT = 3000;
app.listen(PORT, () => {
console.log(`Server is running on <http://localhost>:${PORT}`);
});
pm2 start app.js