Rajeev Kannav Sharma

Posts About

ionic Heroku Deploy

22 Aug 2015

Recently I worked on IonicApp and thought it must be possible to run it over Heroku and that works.


  • Heroku-Toolbet √
  • Ionic √
  • node √
Install express
    npm install express --save
Setup App.json

Additional, a app.json is needed for some meta information about your app.

    "name": "Ionic to Heroku Example",
    "description": "A simple Ionic app for Heroku",
    "repository": "https://github.com/yourUsername/repositoryName",
    "logo": "logoURL",
    "keywords": ["ionic", "Heroku", "whatever"]
Setup server.js

The last thing we need is the file which will be executed by Heroku. Heroku will look for a server.js, so create this file as well on the top level of your ionic project and insert:

var express = require('express'),
app = express();
app.set('port', process.env.PORT || 5000);
app.listen(app.get('port'), function () {
    console.log('Express server listening on port ' + app.get('port'));

Now you can test your app local. Instead of ionic serve, we will install the modules and run it with our express server, so go ahead:

npm install
npm start

If you receive no error, you can access your app on http://localhost:5000/. If you have problems, fix that at your local Once application works fine, You’re almost done! Make sure to commit/push these changes to your repo, so Heroku receives all files we just added.

Deploying your App on Heroku, The above workflow was just standard git stuff, now we make our Heroku deployment. To use Heroku from the command line, you need to have the Heroku-Toolbelt installed. If you are done, open your Terminal and type:

heroku create
git push heroku master

This can take some time, depending on your project size. You can now try to open your app:

heroku open
And if you get stuck… Ask Here

email me rajeevsharma86@gmail.com

Tweet to me at @rajeevkannav.