Implement the Serialization of Passport User [SOLVED]

Tell us what’s happening:
I know there are existing forum posts on this issue, but I couldn’t find a solution yet. The test fails saying “Database connection should be present.” although I don’t see any error in my console. Also, when I hit the button “I’ve completed the challenge”, the console prints “https://www.freecodecamp.org requested”.

I have created an Atlas MongoDB Compass with IP Address 0.0.0.0/0 as instructed in the forum posts and have set the value as mongodb+srv://:@cluster0.0julf.mongodb.net/test in the MONGO_URI key that I created under environment variables section. The server.js is exactly the same as given in the sample solution.

So, if someone can help me understand what’s going on here?

Your project link(s)

solution: https://replit.com/@rockgemini/boilerplate-advancednode-3

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.87 Safari/537.36

Challenge: Implement the Serialization of a Passport User

Link to the challenge:


1 Like

It worked when I cut the block

app.route(’/’).get((req, res) => {
// Change the response to render the Pug template
res.render(process.cwd() + ‘/views/pug/index’, {
title: ‘Connected to Database’,
message: ‘Please login’
});
});

and pasted it over replacing the below block

app.route(’/’).get((req, res) => {
// Change the response to render the Pug template
res.render(process.cwd() + ‘/views/pug/index’, {title: ‘Hello’, message: ‘Please login’});
});

2 Likes

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