That's because you don't go through isAuthenticated() middleware ;
isAuthenticated()
You might want something like this ;
app.use('/homepage', isAuthenticated); app.get('/homepage', (req, res) => { res.sendFile(__dirname + '/public/homepage.html'); });