Advanced Node and Express - Clean Up Your Project with Modules - "Modules should be present"

To pass this challenge I followed the suggestions posted in this FAQ post but cannot get this test to pass. I can’t figure out what the problem is with my code. If anyone has suggestions that would be great. My Code can be found on GLITCH.

Have you done this?

Right after you establish a successful connect with the database instantiate each of them like such: routes(app, db)

(Also for auth(app, db);)

1 Like

@stressstressstress no, that is definitely my issue, so thanks for calling that out. I assume that goes in the server.js file, I’m just not 100% clear on where that is to be added.

1 Like

@stressstressstress Nevermind! I figured it out, I had the function

    if (req.isAuthenticated()) {
        return next();
    }
    res.redirect('/');
  }; 

in the wrong file, so when I added it to the routes.js file and implemented your suggestions it passed!

1 Like