title: Nodejs Mongoose - Model not defined
body: <p>I'm trying to send some data to a database using mongoose. Here is my code so far.</p>
  
  <p><strong>server.js</strong></p>
  
  <pre><code>var express = require('express');
  var wine = require('./routes/wines');
  var bodyParser = require('body-parser');
  var mongoose = require('mongoose');
  
  var app = express();
  
  app.use(bodyParser.urlencoded({ extended: true}));
  app.use(bodyParser.json());
  
  app.get('/wines', wine.findAll);
  app.get('/wines/:id', wine.findById);
  
  app.listen(3000);
  console.log('Listening on port 3000...');
  </code></pre>
  
  <p><strong>wine.js (inside models folder)</strong></p>
  
  <pre><code>var mongoose = require('mongoose');
  var db = mongoose.connection;
  
  var wineSchema = new mongoose.Schema({
      name: String,
      description: String
  });
  
  var Wine = mongoose.model('Wine', wineSchema);
  module.exports = Wine;
  </code></pre>
  
  <p><strong>wines.js (inside routes folder)</strong></p>
  
  <pre><code>exports.addWine = function(req, res) {
  // Problem not defined here
  var silence = new Wine({ name: 'Silence', description:"cena" })
  console.log(silence.name) // 'Silence'
  // add it to the database
  };
  </code></pre>
  
  <p>I keep getting this error and i have no idea why.
  <code>ReferenceError: Wine is not defined</code></p>
  
  <p>I've exported Wine in wine.js (models), shouldn't I be able to use it everywhere ?</p>
  
  <p>Thank you in advance !</p>