In your example, you are only 'requiring' the config package. You haven't actually asked for it to be loaded.
Typical use of the loading of config is based on the NODE_ENV value. This describes the environment you are running the node app under. E.g. production, development etc.
You can set the NODE_ENV value from the command line. E.g.
export NODE_ENV=development; node ./src/app.js
Then, in your code, you then assign an element from your config file into a var or constant. E.g.
const dbconfig = config.get('dbConfig');
So, using the below file as an example...
In /config/development.json
{
"dbConfig": {
"user": "some-user",
"password": "somePassword",
"connectString": "server:port/schema"
}
In the file you're trying to reading the config into...
import config from 'config';
const dbconfig = config.get('dbConfig');
console.log ("User is " + dbConfig.user); // should print 'User is some-user'
Don't forget to set the NODE_ENV value so that config knows what file to read from...
export NODE_ENV=development; node ./src/app.js
or, using your example
export NODE_ENV=default; node ./src/app.js