External js calls another external js function

Hi,

I have two external config.js and service_check.js files located in /geneiacs/config/ext.
My question is how should I call function located in service_check.js from config.js? Below is what I did, but it is not working.

service_check.js

function findService(args, callback) {

}
exports.findService = findService;

config.js

const findService = require(’./service_check);
function getConfig (args, callback){
var IP = 192.168.1.1;
const service=ext(‘service_check’, ‘findservice’, IP);
}

ext() is only used inside a GenieACS provision script. You should be able to do this in config.js:

const findService = require('./service_check');
function getConfig (args, callback){
  var IP = 192.168.1.1;
  const service=findService.service_check(IP);
}
1 Like