Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在研究一些服务器端的 javascript,并且我有一些我想保持敏感的数据,所以它位于一个非公开的目录中。假设我将它放在一个函数中 - 然后我如何从另一个 javascript 文件中调用该函数?
感谢 Quentin 将我指向相关文档。我最终得到的解决方案是:
敏感的.js:
exports.data = "data";
应用程序.js:
var sensitive = require('./sensitive'); var data = sensitive.data;