I've been struggling to destruct my mongo object in another file, my object structure is like below.
const env = {
project: 'CRIBBBLE BACKEND',
url: 'localhost',
api: {
url: 'https://api.dribbble.com/v1/',
},
port: parseInt(process.env.PORT, 10) || 3000,
mongo: database,
};
export default env;
But when I'm trying to import
the mongo
object in another js
file like this { mongo } from 'config'
the returned value is undefined
.
But if I change the export default value to module.exports
it works as its expected.
So, I'm just wondering what is the difference between module.exports
and export default
?