There is a file
var express = require('express'); // switch Express on var http = require('http'); var path = require('path'); var nconf = require('config'); var app = express(); // create function for handling request app.set('port', nconf.get('port')); http.createServer(app).listen(app.get('port'), function(){ // say, that express will be handler for income requests console.log('Express listening on port ' + nconf.get('port')); }); In it, I connect the config module
There is a file in which this config is exported.
var config = require('nconf'); var path = require('path'); config.argv().env().file({file: path.join(__dirname, 'config.json')}); module.exports = config; The problem is that for some reason this config module is not visible in other files when connected. What have I done wrong?
ps I launch through the console thus set NODE_PATH="." && node app.js set NODE_PATH="." && node app.js