title: authenticate.getToken is not a function on node.js v12.18.2
body: <p>I am receiving an <code>authenticate.getToken is not a function</code> error.</p>
  <pre class="lang-js prettyprint-override"><code>var express = require('express');
  const bodyParser = require('body-parser');
  var User = require('../models/user');
  const passport = require('passport');
  var authenticate = require('../authenticate');
  
  var router = express.Router();
  router.use(bodyParser.json());
  
  /* GET users listing. */
  router.get('/', function (req, res, next) {
      res.send('respond with a resource');
  });
  router.post('/signup', (req, res, next) =&gt; {
      User.register(
          new User({ username: req.body.username }),
          req.body.password, (err, user) =&gt; {
              if (err) {
                  res.statusCode = 500;
                  res.setHeader('Content-Type', 'application/json');
                  res.json({ err: err });
              } else {
                  passport.authenticate('local')(req, res, () =&gt; {
                      res.statusCode = 200;
                      res.setHeader('Content-Type', 'application/json');
                      res.json({ success: true, status: 'Registration Successful!' });
                  });
              }
          }
      );
  });
      
  router.post('/login', passport.authenticate('local'), (req, res) =&gt; {
      var token = authenticate.getToken({ _id: req.user._id });
      res.statusCode = 200;
      res.setHeader('Content-Type', 'application/json');
      res.json({ success: true, token: token, status: 'You are successfully logged in!' });
  });
      
  router.get('/logout', (req, res) =&gt; {
      if (req.session) { req.session.destroy();
          res.clearCookie('session-id');
          res.redirect('/');
      } else {
          var err = new Error('you are not logged in');
          err.status = 403;
          next(err);
      }
  });
  
  module.exports = router;
  </code></pre>