以下片段来自一些自动生成的快速代码:
//Load configurations
//if test env, load example file
var env = process.env.NODE_ENV || 'development',
config = require('./config/config')[env],
auth = require('./config/middlewares/authorization'),
mongoose = require('mongoose');
[env] 令人困惑,对我来说看起来不像是有效的 javascript。你怎么能调用这样的函数?
require('./config/config')[env]