title: mongoose is not defined
body: <p>I'm following <a href="https://www.codementor.io/olatundegaruba/nodejs-restful-apis-in-10-minutes-q0sgsfhbd" rel="nofollow noreferrer">this tutorial</a>, which creates a To-do list using express and mongo. I am getting the following errors:</p>
  
  <pre><code>body-parser deprecated undefined extended: provide extended option server.js:12:20
  C:\todoListApi\api\controllers\todoListController.js:4
  var Task = mongoose.model('Tasks');
             ^
  ReferenceError: mongoose is not defined
      at Object.&lt;anonymous&gt; (C:\todoListApi\api\controllers\todoListController.js:4:12)
      ...
  </code></pre>
  
  <p>The <code>body-parser deprecated</code> error I have tried to fix using <a href="https://stackoverflow.com/questions/25471856/express-throws-error-as-body-parser-deprecated-undefined-extended">this post</a> to no avail (although it seems like more of a warning). </p>
  
  <p>The mongoose error doesn't make any sense because mongoose ids defined directly before it:</p>
  
  <pre><code>var mongooose = require('mongoose').Mongoose,
      Task = mongoose.model('Tasks');
  </code></pre>
  
  <p>But it's also defined in server.js:</p>
  
  <pre><code>var express = require('express'),
      app = express(),
      port = process.env.PORT || 3000,
      mongoose = require('mongoose'),
      Task = require('./api/models/todoListModel'),
      bodyParser = require('body-parser');
  
  mongoose.Promise = global.Promise;
  mongoose.connect('mongodb://localhost/Tododb');
  
  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(bodyParser.urlencoded(bodyParser.json()));
  
  var routes = require('./api/routes/todoListRoutes');
  routes(app);
  
  app.listen(port);
  
  console.log('todo list RESTful API server started on: ' + port)
  </code></pre>
  
  <p>I changed this from the original tutorial to add <code>.Mongoose</code> because this post said it would work.</p>