Cannot GET / or TypeError

I am stuck with this challenge for days now and I am a complete beginner in JS.I either get an error stating cannot GET / or TypeError cannot read property ‘split’ of null.Please help me

Your project link(s)

solution: https://replit.com/@473dhariniiyer/boilerplate-advancednode-5

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 9; Gocast) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.116 Safari/537.36 EdgA/46.03.2.5155.

Challenge: Implement the Serialization of a Passport User

Link to the challenge:

Welcome there,

You have two of the same route:

app.get('/',function(req,res){
  res.render('/views/pug/index',{});
});


myDB(async (client) => {
  const myDataBase = await client.db('database').collection('users');

  // Be sure to change the title
  app.route('/').get((req, res) => {

Otherwise, it could be an issue with your Database URI, if you are getting a cannot read property ‘split’ of null.

Hope this helps

Could you please tell me how should i define the route? cause even when i didnt write the first block of code the second block still gave me the error Cannot GET /

The answer is given at the end each lesson. If you are struggling with how to use Express, I recommend you go back to the challenges covering it:

Otherwise, it would help to see the full error message.

Hope this helps

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