I am new to node.js. I have the following code
module aws.js
....
const awssvc = { dynamoQuery }
module.exports = { awssvc }
module A.js
const { awssvc } = require( ./index )
....
module.export = { a }
module B.js
const { awssvc } = require( ./index )
....
module.export = { b }
index.js
const { awssvc } = require('./aws');
const { a } = require('./A');
const { b} = require('./B');
module.exports = { awssvc, a, b}
In A.js
when executing awssvc.dynamoQuery
, I got TypeError: Cannot read property 'dynamoQuery' of undefined
.
What have I missed?
Or what should or should not go into index.js?