I am currently facing an issue with two Pug files, index.pug and search.pug, stored in a /views folder. In my index.pug file, I have the following line of code:
a(href="/search.pug") Search
In my JavaScript file, I have specified the view engine as Pug and set up static file serving for the views folder like this:
app.set('view engine', 'pug');
app.use(express.static('views'));
However, when I click on the link to the search.pug page from the index.pug page, instead of redirecting me to it, the search.pug file gets downloaded. How can I resolve this issue?
I tried changing app.use(express.static('/views')); but now, instead of downloading the page, I receive an error message saying: Cannot GET /search.pug