title: Export a function with Node JS
body: <p>I need help with function export in Node.Js</p>
  
  <p>Here is my <strong>module.js</strong></p>
  
  <pre><code>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');
  }
  </code></pre>
  
  <p>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: <em>Model.User is not a function</em></p>