Redirect to homepage error

This is my code

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

app.route('/')
  .get((req, res) => {
      res.render(process.cwd() + '/views/pug/index.pug', {title: "Hello", message: "Please login", showLogin: true});
  });

and it i think it is working correctly i.e when a user logout it will redirect it to ‘/’ homepage But i can’t pass the challenge.
This is the error i’m getting in fcc

// running test
When a user logs out they should be redirected to the homepage
// tests completed

I’m experiencing this too. Strange I’m not seeing more posts about it since they give you the code in the challenge description.

Hi, I have the same issue with both /logout and ensureAuthenticated function.

Have someone been able to pass those two challenges?

1 Like

It’s resolved in Help in Advanced Node and Express - Create New Middleware