I have a bunch of middleware. At the first app.use
I test if the process is under duress, and if so I want it to just send the static /index.html
f
Not sure if I understand correctly, but try this:
app.use(function(req, res, next) {
if (something && req.path !== '/')
return res.redirect('/');
next();
});
app.get('/', function(req, res, next) {
if (something)
return res.sendfile('/public/index.html', { root: __dirname + '/..' });
next();
});
app.use(express.static(...));