A simple way to deploy a React App and Database to Heroku (Code provided below)
🔴These two lines of code go in your main server file:
app.use(express.static(path.resolve(__dirname, "../build")));
app.get('/*', function (req, res) {
res.sendFile(path.join(__dirname, '../build', 'index.html'));
});
🔴These two lines of code go in your package.json:
"main": "./server/index.js",
"start": "node ./server/index.js && npm build",
Ещё видео!