我对 Node.js 平台上的 Web 开发感兴趣。我的主机操作系统是 Windows 7。设置开发环境的首选方式是什么。直接在主机上运行还是在基于 linux 的虚拟机中运行?这两种方法的优缺点是什么?
如果我使用虚拟机,我是否仍然可以在 Windows 中运行文本编辑器和 Web 浏览器(出于性能原因)?
最佳答案
我们有一个系统,通过它我们只使用一个配置文件,它处理我们所有的问题,比如路径差异( "c:\blarg"
vs "~user/blarg"
),并且作为奖励,让我们控制调试和生产环境之间的差异。
Node.js 是跨平台的,所以我们完全有开发人员在各种计算机上工作,这完全没有问题。
这是我在文件存储项目中使用的示例配置文件:
/**
* All of these are mandatory except for log_level (which defaults to "info", 1)
* and log_echo_to_console (which defaults to false)
*/
exports.config = {
log_level: 0,
log_file: "/path/to/send.log",
request_log_file: "/path/to/send_requests.log",
log_echo_to_console: true,
port_number: 8088,
no_notification_emails: true,
image_url_base: "http://s3.amazonaws.com/", // MAKE SURE THIS ENDS IN "/"
tmp_file_folder:"/tmp/",
s3_info: {
key: 'xxxxxx',
secret: 'yyyyy',
file_bucket: 'sendtransfer/',
},
backend_info: {
db_info: {
server: "localhost",
user: "db_user",
password: "secret",
database: "SendRemote",
pooled_connections: 125,
idle_timeout_millis: 30000
},
memcache_info: {
host: "127.0.0.1",
port: "31111",
pooled_connections: 200,
timeout: 20000
}
},
debug_server: true
};
var local = require('local.config.js');
fs.writeFile(local.config.log_file);
// etc
https://stackoverflow.com/questions/12581416/
相关文章:
linux - 是否有一个 linux 命令来确定与给定进程 ID 关联的窗口 ID?
php - 根据外部请求在 Netbeans 中启动 XDebug
c++ - 我在哪里放置第三方库来设置 C++ Linux 开发环境?
python - 如何在 Python 中监听 Linux 中的 'usb device inser
php - 脚本 "/home/...../public_html/index.php"的 UID
linux - 在像 "f () {}"这样的 bash shell 脚本函数定义中使用的括号是什么