I\'m new to node.js. i have two files. they are index.js and db.js
my index.js is
var connection =
if you want something from the db module to be accessible in other modules, you need to expose it, by using module.exports
add to the end of your db.js file:
module.exports = {
appModel : appModel,
Device : Device
};
and then in your index.js you can do:
device = new connection.Device({
id: 93,
name: 'test1'
});
you can read more about it here