Deploy Yeoman App to Heroku

8 years ago

Open the command line and run the following

Note: There are now far easier alternatives like using Heroku CLI, Heroku's GitHub Integration, or one of the many framework CLIs like create-react-app or angular-cli

mkdir jl03
cd jl03
yo webapp
grunt build
cd dist && npm init
npm install express gzippo --save
echo “web: node server.js” > Procfile
echo “var express = require('express');” > server.js
echo “var http = require('http');” >> server.js
echo “var gzippo = require('gzippo');” >> server.js
echo “var app = express();” >> server.js
echo “app.use(gzippo.staticGzip('' + __dirname));” >> server.js
echo “app.get('/', function(req, res){” >> server.js
echo “ res.sendfile('index.html');” >> server.js
echo “});” >> server.js
echo “var server = http.createServer(app);” >> server.js
echo “server.listen(process.env.PORT || 5000);” >> server.js
echo “node_modules” > .gitignore
heroku create <appname>
heroku ps:scale web=1
heroku config:set PORT=80
git push heroku master
heroku open
Discuss on Twitter