So I am trying to link out to my privacy policy from the footer through the following:
<a href="/privacypolicy"> Privacy Policy </a>
However, when the homepage is rendered on my local host, and I try to access the privacy policy (privacypolicy.ejs
), I receive the error that
Cannot GET /privacypolicy
My privacy policy page is in a folder called views, and I am already serving this folder in my express server through:
app.set('views', join(__dirname, 'views'));
Any thoughts on why I am not able to render the privacy policy?
Answer
You have to set up a handler to handle your request – GET /privacypolicy
.
Do the same with what you did for homepage
:
app.get('/privacypolicy', (req, res) => { res.render('privacypolicy'); })