How to use generators support in Heroku

The use of Javascript has increased and the projects are getting more complex. The EcmaScript 6 brings many new features into languages that should make the development easier and make the Javascript ecosystem richer. Currently you could use some of the features on the server side with Node.js newer versions like 0.11. There isn’t many hosting services where you could select the running node engine. Luckily, Heroku has this support for this, there is nice site for versions.

2014-03-29-115418_1096x450_scrot

As you could see the version 0.11.12 is unstable but still you could use it. Lets assume you have already setup the project, now change the package.json, node property set it to ~0.11.


{
  "name": "myapp",
  "description": "a really cool app",
  "version": "0.0.1",
  "engines": {
    "node": "~0.11"
  },
  "dependencies": {
    "co": "^3.0.5"
  }
}
web: node --harmony server.js

The last step is to change the Procfile and add the –harmony flag. So the file should look something like this. This enables only small part of the ES6 functionality.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s