Skip to content

Commit d326e3d

Browse files
committed
create Procfile for server
1 parent 5b7ad7d commit d326e3d

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: node src/server/index.js
1+
web: npm run heroku-client

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,34 @@ Follow tutorial [Deploying Full Stack React App to Heroku](https://jojozhuang.gi
3939

4040
Follow tutorial [Continuously Deploy Full Stack React App to Heroku and Netlify with Travis-CI](https://jojozhuang.github.io/tutorial/continuously-deploy-full-stack-react-app-to-heroku-and-netlify-with-travis-ci) to continuously deploy this Full Stack app to Heroku(RESTful API) and Netlify(Frontend React).
4141

42-
## Upgrade to heorku20 stack
42+
## Steps(Updated on July 18, 2021)
43+
Manually deploy the same git repo to two apps in heroku. Use `Multi Procfile buildpack` to deploy multiple apps in a monorepo.
44+
45+
### Server
46+
Create app `code-editor-api` for backend api.
47+
```sh
48+
cd code-editor-react
49+
heroku login
50+
heroku create -a code-editor-api
51+
heroku buildpacks:add -a code-editor-api heroku-community/multi-procfile
52+
heroku buildpacks:add -a code-editor-api heroku/nodejs
53+
heroku config:set -a code-editor-api PROCFILE=src/server/Procfile
54+
git push https://git.heroku.com/code-editor-api.git HEAD:master
55+
```
56+
57+
### Client
58+
Create app `code-editor-react` for client website.
59+
```sh
60+
cd code-editor-react
61+
heroku login
62+
heroku create -a code-editor-react
63+
heroku buildpacks:add -a code-editor-react heroku-community/multi-procfile
64+
heroku buildpacks:add -a code-editor-react heroku/nodejs
65+
heroku config:set -a code-editor-react PROCFILE=Procfile
66+
git push https://git.heroku.com/code-editor-react.git HEAD:master
67+
```
68+
69+
## Update
4370
Server.
4471
```sh
4572
cd code-editor-react

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"description": "Create an online code editor using React, Node.js, Express and Webpack.",
55
"main": "src/server/index.js",
66
"scripts": {
7+
"heroku-server": "node src/server/index.js",
8+
"heroku-client": "node server.js",
79
"start": "node src/server/index.js",
810
"build": "webpack --env production",
911
"client": "PORT=3000 webpack serve --env development --devtool inline-source-map --hot",

src/server/Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: npm run heroku-server

0 commit comments

Comments
 (0)