Advanced Node and Express - Logging a User Out-can't get passed second challenge

I’m having trouble passing this challenge. I passed the first part " req.Logout should be called in your /logout route" but I can’t seem to pass the second part “Logout should redirect to the home page.” It seems fine but I feel like I’m missing something, please help.

app.route('/login')
          .post(passport.authenticate('local', { failureRedirect: '/' }),(req,res) => {
               res.redirect('/profile');
        console.log(`User ${req.user} attempted to log in.`);

  res.redirect('/');
          });

        app.route('/profile')
          .get(ensureAuthenticated,(req,res) => {
               res.render(process.cwd() + '/views/pug/profile'+ { username: req.user.username });
        });


app.route('/logout')
  .get((req, res) => {
    req.Logout();
    res.redirect("/");
});


app.listen(process.env.PORT || 3000, () => {
  console.log("Listening on port " + process.env.PORT);
});


app.use((req, res, next) => {
  res.status(404)
    .type('text')
    .send('Not Found');
});


Here’s my project page: https://glitch.com/~legend-earthy-ghoul

Hello!

It’s just a typo, instead of req.Logout() should be req.logout(). I don’t know why in the challenge it uses uppercase L.

It worked! thank you!

1 Like