Updated app.js to remove error when not run from backend directory

This commit is contained in:
Isaac Grynsztein
2020-03-25 03:57:15 -04:00
parent 6c22c0e708
commit 47a1173a80

View File

@@ -1625,8 +1625,12 @@ app.use(function(req, res, next) {
return next(); return next();
} }
fs.createReadStream('./public/index.html').pipe(res); let index_path = path.join(__dirname, 'public', 'index.html');
fs.createReadStream(index_path).pipe(res);
}); });
app.use(express.static('./public')); let public_dir = path.join(__dirname, 'public');
app.use(express.static(public_dir));