node.js - Dynamically load Javascript functions -
I want to load a dynamically and want to call Javascript functions with a JSON file. This idea is to build a plugin framework that will enable others to add functionality by typing a function and updating the JSON file. For example, with the following JSON: {"plugins": {"random": {"name": "random number generator", "hook": "random"}}} ... and the following plugin: random.js module.export.ron = function () {return mathematics. (Mathematics. RANDOM () * 100); } I want to be able to parse the JSON file and want to call the run function of any plugin How can I load and call the run function on random? Depending on what you have described, just need the requirement module. var plugins = required ('./plins.json'); Var plugins for = objects Kids (plugins); For (var i = 0; i & lt; plugin kios; i ++) plugins [plugin keys [i]]. Func = is required ('.' '[Plugin ki [i]. Hook +' .js...