Implement the Serialization of a Passport User not connecting to db

Tell us what’s happening:
I can’t pass this test. I’m guessing I’m missing something obvious, but I can’t figure out what that might be. I added the mongo URI variable to .env, and connection.js appears to already have all the necessary code to connect. But the test is saying it isn’t connect.

Your project link(s)


Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 13729.45.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36.

Challenge: Implement the Serialization of a Passport User

Link to the challenge:

Hello there,

Just some things i notice:

  1. Duplicate:
app.route('/').get((req, res) => {
//  res.render("pug");
  res.render(process.cwd() + '/views/pug/index', {title: 'Hello', message: 'Please login'});
  1. This should come before the DB logic:
fccTesting(app); //For FCC testing purposes
app.use('/public', express.static(process.cwd() + '/public'));
app.use(express.urlencoded({ extended: true }));

Because it uses middleware, and middleware mounted after setting up a route does not get used by that route.

Otherwise, remember that there is the Gist page with the example code, if you are unsure.

Hope this helps

Hi. I moved it up with no change.
Also the duplicate is commented out, or are you saying there is something else duplicated?

You have 2 app.route("/"). One within the DB logic, and one outwith. Again, looking at the example code linked to at the bottom of each challenge might help.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.