Wednesday, July 10, 2019

Saturday, July 6, 2019

Deployment to Heroku (using Heroku CLI)

//package.json
"scripts": {
 "start":"node path/to/your/app.js"
 },
//app.js
const port = process.env.PORT || 3000
const app = express()
... 
app.listen(port, () => {
 console.log('server up on port ' + port)
})
heroku login
heroku keys:add // add ssh public key to heroku
git init 
git add . 
git commit -m "your comment comes here"
heroku create your-project-name // create a project on heroku
heroku git:remote -a tecknovice-weather-server // add remote branch
heroku buildpacks:set heroku/nodejs //or any another language
git push heroku master //push code from local to remote branch
heroku logs --tail // for real time logging