express-control-room
Version:
Express Control Room is a middleware package for the Express.js framework designed to provide a centralized control interface for managing and monitoring various aspects of your Express application and the server. It offers features such as real-time logg
31 lines (23 loc) • 713 B
JavaScript
const pm2 = require('pm2');
const listProcess = (req, res) => {
pm2.connect(function (err) {
if (err) {
return res.status(400).json({
status: false, message: 'error', data: err
})
}
pm2.list(function (err, processes) {
if (err) {
return res.status(400).json({
status: false, message: 'error', data: err
})
} else {
res.status(200).json({
status: true, message: 'success', data: processes
})
}
pm2.disconnect(); // Disconnect from PM2
});
});
}
module.exports = listProcess;