I am trying to configure my express application to redirect to a login page based on some logic. I have the following:
app.use('/', function(req, res, next){
if(!req.session.accessToken){
//do something here
}
next();
});
I have a login.html file located in the root of the directory my application is being served from, I am just unsure what I need to call on the res object e.g. redirect, send
Also, I know the above will actually cause an infinite loop.
What's the correct approach here?