title: TypeError: Cannot read property 'findAll' of undefined
body: <p>I am developing a web app that uses angularjs, nodejs, and postgresql. I have two tables in my database, one for inventory and the other for client. I combined my index.js files, in my routes folder, in which both tables have a findAll function. When I put the two references for the tables in the index.js, only one works at a time. Here is the template that both tables use that includes findAll: </p>
  
  <pre><code>exports.getobjects = function(req, res) {
  models.Object.findAll().then(function(objectss){
      res.json(objects);
  });
  };
  </code></pre>
  
  <p>Has anyone done what I am trying to do?
  UPDATE: Here is entire index.js file :</p>
  
  <pre><code>/*
  * GET home page.
  */
  
  var models = require("../models");
  
  exports.index = function(req, res) {
  res.render('index', {
      title : 'title'
   });
   };
   /* clients */
   exports.getclients = function(req, res) {
   models.Client.findAll().then(function(clients){
      res.json(clients);
  });
  };
  
  exports.saveclients = function(req, res) {
  models.Client.create({
      name: req.body.name,
      ssn: req.body.ssn,
      dln: req.body.dln,
      dls: req.body.dls,
      zip: req.body.zip,
      email: req.body.email,
      notes: req.body.notes,     
  }).then(function(clients){
      res.json(clients.dataValues);
  }).catch(function(error){
      console.log("ops: " + error);
      res.status(500).json({ error: 'error' });
  });
  };
  
  /*inventory*/
  exports.getunits = function(req, res) {
  models.Unit.findAll().then(function(units){
      res.json(units);
  
  });
  };
  
  exports.saveunits = function(req, res) {
  models.Unit.create({
      name: req.body.text,
      quant: reg.body.quant                        
  }).then(function(units){
      res.json(units.dataValues);
  }).catch(function(error){
      console.log("ops: " + error);
      res.status(500).json({ error: 'error' });
  });
  };
  </code></pre>