Tell us what’s happening:
I’ve written the following.
app.get('/profile', ensureAuthenticated, (req, res) => {
res.render('pug/profile');
});
This appears to work, and redirects me to the homepage (/
) when I attempt to access /profile
without being authenticated.
However, the test case is failing for it, unless I write it in the same way as the example:
app
.route('/profile')
.get(ensureAuthenticated, (req,res) => {
res.render(process.cwd() + '/views/pug/profile');
});
Am I mistaken, are these not completely equivalent in the context of this particular challenge?
Your project link(s)
solution: https://boilerplate-advancednode.sethipandi.repl.co
Your browser information:
User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0
.
Challenge: Create New Middleware
Link to the challenge: