I did a little research and couldn't find anything that makes my case success.
So, I'm loading .js
from external scripts with require(..)
, each script exports a function ..
main.js
var main=10;
var mod1 = require("./mod1.js");
mod1.js
module.exports=function(){
console.log('loaded');
var net=require('net'); // i don't want it to be able to require certain node.js apis
net.create...;
}
I saw some ways where a .json
file declares the permissions
and if so it grants access to script. How can something like that be achieved for core node.js apis?