login heroku in terminal =>(heroku login)
Create a [production.json] copy from [default.json]
(or you want different database etcโฆ and changing)
add
โโโโโโโ "scripts": {
โโโโโโโ "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install -โprefix client && npm run build โ-prefix client"
โโโโโโโ },
in root [package.json]
add
โโโโโโโ const path = require("path");
โโโโโโโ // Serve static assets in production
โโโโโโโ if (process.env.NODE_ENV == "production") {
โโโโโโโ // Set static folder
โโโโโโโ app.use(express.static("client/buildโ));x
โโโโโโโ app.get("*", (req, res) => {
โโโโโโโ res.sendFile(path.resolve(__dirname, "client", "build", "index.html"));
โโโโโโโ });
โโโโโโโ }
in [sever,js]
start to deploy
in terminal
heroku create
git add .
and commitheroku login
heroku git:remote -a <Your-App-Domain>
git remote heroku add heroku <Heroku git URI>
not sure yetgit push heroku master
heroku open