Advanced Node and Express test for redirect keeps failing

Tell us what’s happening:
I’m having issues passing the tests for redirects back to the home page and I feel that perhaps it is an issue with test? I tested the routes and they do redirect back to the home page. I’m having the same test fail for the “Create a middleware” challenge as well.

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0.

Challenge: Advanced Node and Express - Logging a User Out

Link to the challenge:
https://www.freecodecamp.org/learn/information-security-and-quality-assurance/advanced-node-and-express/logging-a-user-out

1 Like

Im having the same issue. looking for solution. will get back to you if i figure it out or find the answer.

Found the solution. For some reason they need to title of the ‘/’ to be ‘Home Page’.
Just change the variable title on the home page route and it should work.

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

rename the page title to “Home page” solved the problem.