Is it possible to have the same config file for server node.js and client js code?
Now I use .json config for node.js, but can convert it to any format
Is it possible to have the same config file for server node.js and client js code?
Now I use .json config for node.js, but can convert it to any format
如果没有更多信息,我只能提供一个简单的建议:Require.js。您可以在 Node.js 代码中引用配置模块并在客户端脚本中引用它。只要确保配置文件可以提供给客户端。
// Example reference
var config = require('./data/config.js');