title: Route.get() requires a callback function but got a [object Undefined]. What did I do wrong?
body: <p>I have checked many answers in other pages and forums, but I still don't get it. What did I do wrong? Help me</p>
  
  <p>*edited. I have added requiring routes and app.use. It looks like function isLOggedIn is not exporting but I don't know how to do that. I did like this in another app, it worked there.</p>
  
  <p><strong>auth-routes.js</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>const express = require("express"),
    router      = express.Router(),
    passport    = require("passport")
  
  function isLoggedIn(req, res, next) {
    if (req.isAuthenticated()) {
      return next()
    }
  
    res.redirect("/auth/login")
  }
  
  module.exports = router
  </code></pre>
  
  <p><strong>user-routes.js</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>const express  = require("express"),
    router = express.Router(),
    authRoutes = require("./auth-routes")   
  
  router.get("/profile", authRoutes.isLoggedIn, (req, res) =&gt; {
    res.render("user/profile", {user: req.user})
  })
  
  module.exports = router
  </code></pre>
  
  <p><strong>requring routes</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>const titleRoutes = require("./routes/title-routes")
  const authRoutes = require("./routes/auth-routes")
  const userRoutes = require("./routes/user-routes")   
  </code></pre>
  
  <p><strong>app.use</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>app.use(titleRoutes)
  app.use("/auth", authRoutes)
  app.use("/user", userRoutes)
  </code></pre>