950 B
950 B
Installation and Pushing Code
Installation
-
At root directory of nodejs app
git init git add . git commit -m 'initialize'
• (Make sure to install heroku cli)
• heroku create or heroku create appname
-
If there is already an existing app then we need to change the prev origin to current one by:
heroku git:remote -a appname -
For changing app name, remote name has to be changed too.
git remote rename heroku newname
or
git remote heroku newname
heroku git:remote -a newname
- For changing app name(this has to be done before)
heroku apps: rename newname
or for outside git repository
heroku apps: rename newname —app oldname
Pushing Code
git push heroku main
For non-main branch:
git push heroku testbranch:main
In nodejs app:
app.listen(process.env.PORT || 3000,()=>{
console.log('listening');
})