Please I need someone to tell me what I am doing wrong as my code is not passing test 1

Tell us what’s happening:
Describe your issue in detail here.

Blockquote
I get this error on the console
Error: Failed to lookup view “pug” in views directory “./views/pug”

Your project link(s)

Blockquote
This is my solution link
boilerplate-advancednode - Replit

solution: boilerplate-advancednode - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36

Challenge: Implement the Serialization of a Passport User

Link to the challenge:

line 40 and 59, res.render('pug' . I don’t see you have a file named pug.pug in ./views/pug.
res.render’s first argument is a file name (without extension, e.g. res.render('chat', ....
I might be wrong though.

It should be index with that setup or you can comment out the app.set('views', './views/pug') and render pug (which should pick the index file).

I think it is because the challenge that had you set up the Template Engine didn’t expect you to use app.set but res.render and that code is then moved inside the DB connection function and the first argument is changed.

Set up Template Engine
https://gist.github.com/camperbot/3515cd676ea4dfceab4e322f59a37791

Implement the Serialization of a Passport User
https://gist.github.com/camperbot/175f2f585a2d8034044c7e8857d5add7

1 Like

You are right just had to comment out app.set(‘views’, ‘./views/pug’) and passed the test.

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