I want to execute my node command execSync('DB_HOST=localhost DB_DATABASE=test_ver DB_USERNAME=root DB_PASSWORD=Testing@123 PORT=5010 nodemon server.js ');
, from this path /var/www/test/
, can anyone please help me how to do this ? here i have added my whole function
commonService.exec_api = async function () {
return new Promise(async function (resolve) {
const execSync = require('child_process').exec;
let child_process_obj = execSync('DB_HOST=' + process.env.UNITTEST_DB_HOST + ' DB_DATABASE=' + process.env.UNITTEST_DB_DATABASE + ' DB_USERNAME=' + process.env.UNITTEST_DB_USERNAME + ' DB_PASSWORD=' + process.env.UNITTEST_DB_PASSWORD + ' PORT=' + process.env.UNITTEST_API_BACKEND_PORT + ' nodemon server.js ');
let unittest_api_backend_process_id = child_process_obj.pid;
const sessionStorage = require('node-sessionstorage')
sessionStorage.setItem("backend_pid", unittest_api_backend_process_id);
resolve(true);
});
}