Overview
Prerequisites
If not already done so, create an account on Heroku.
Install the Heroku CLI for your platform and log in with your credentials in the terminal. Official guide here.
heroku login
1. Create Remote
In the terminal (from your project folder) run the following CLI command
Once complete, a message will display the live url of your new project.
2. Prepare Project
In package.json
find scripts
and add add these 2 lines:
"postinstall": "npm run build:ssr",
In the same file modify the build
script to read:
"build": "ng build --prod",
3. Create Procfile
At the root of the project create a new file. Name it "Procfile" (with NO extension). In the file add this line:
web: npm run start:heroku
4. Build for deployment
In the terminal run the following CLI command
npm run build:ssr
5. Commit
In the terminal run the following GIT commands:
git status
git add.
git commit -m "first"
git push heroku master
Once deployment is complete, run this line in the terminal:
heroku open
The browser will open. If you see application error instead of your project, run this line in the terminal:
heroku logs --tail