I'm almost done refactoring code taken from here: https://github.com/agracio/edge-js-quick-start
I've added two classes that handle repeatable code, but I'm stuck in two lines of code. I can't for the life of me figure out what they do. I also don't seem to understand what edge_app_root targets (it's a folder but I suspect it targets some file? )
process.env.EDGE_USE_CORECLR = 1; process.env.EDGE_APP_ROOT = baseNetAppPath;
const path = require('path');
var version = process.argv[2];
// print process.argv
process.argv.forEach((val, index) =>
{
console.log(+index + ":" + val);
});
console.log();
//by default the core will be used (and standard is not supported)
var namespace = 'QuickStart.' + version.charAt(0).toUpperCase() + version.substr(1);
if (version === 'core')
{
version = 'coreapp';
console.log("coreapp");
}
const baseNetAppPath = path.join(__dirname, '/src/' + namespace + '/bin/Debug/net' + version + '2.0');
process.env.EDGE_USE_CORECLR = 1;
if (version !== 'standard')
{
console.log("version is not standard")
process.env.EDGE_APP_ROOT = baseNetAppPath;
console.log("process.env.EDGE_APP_ROOT:\n" + baseNetAppPath+"\n");
}
var edge = require('edge-js');
var baseDll = path.join(baseNetAppPath, namespace + '.dll');
console.log(`basedll: ${baseDll}`);
//load functions from namespaces.cs files
var localTypeName = namespace + '.LocalMethods';
var namespace2 = namespace + '.InnerMethods';
console.log(`Using basedll:${baseDll}\n namespace2:${namespace2}\n`);
var getList = edge.func({
assemblyFile: baseDll,//should be the same
typeName: namespace2,//namespace + '.InnerMethods',
methodName: "GetList"
});
getList('', function (error, result)
{
if (error) throw error;
console.log(namespace + '.InnerMethods');
console.log(result + "\n");
});
Thanks for your time!
From the Edge.js ReadMe:
Source: https://github.com/tjanczuk/edge
By default edge looks for its config files (ex: .deps.json) in your current working directory or you if those files are somewhere else you'd specify the directory with EDGE_APP_ROOT.