I need help with function export in Node.Js
Here is my module.js
var knex = require('knex')({
client : 'mysql',
connection : {
host : 'localhost',
user : 'root',
password : '123',
database : 'dbNode'
}
}),bookshelf = require('bookshelf')(knex);
var user = bookshelf.Model.extend({
tableName : 'tblUsers',
idAttribute : 'email'
});
var note = bookshelf.Model.extend({
tableName : 'tblNotes',
idAttribute : 'noteId'
});
module.exports = {
User : user,
Note : note,
};
module.exports = function(owner) {
return knex('note').where('public',1).orWhere({ownerName : owner}).select('noteId');
}
I have to export both the function and the bookshelf models (User and Note) but when I try to use the Model.User it returns me the error: Model.User is not a function