io.js is a new runtime for your Node.js applications. It "Brings ES6 to the Node community" today. Also, you might have heard that io.js and NodeJs are going to merge. What you might not know is that the new version of node is a fork of io.js. So by knowing more about io.js, you will have a leg up as the next version of node is released. In this course, we will install io.js and see what we need to do to switch our existing applications over to using io.js. We will also do a quick check-in on the new possibilities that io.js supports in the form of EcmaScript 6. Finally we will deploy an io.js application to Heroku.
Running Node Applications on io.js Okay, so now we have io. js installed on our computers. What does it take to run an application in io. js? This module shows you how easy that is and some things that you might need to tweak. Let's go. In order to demonstrate this, I have created three, small, demo applications. One is a simple web application running on the Express framework built with standard Node, the Node of your grandfathers running the current version of Node without switches and any new features. Secondly, I created a little Koa application. This is interesting since running Koa requires us to use generators that is part of ECMAScript 6. Getting that to work with Node requires to tell Node to use the not yet officially released "harmony" features of Node. In order to show ECMAScript 6 features, I've created some small demos that I borrowed from the excellent introduction course to ECMAScript 6 here on Pluralsight. Okay, it's time to get this thing to work. Off to the code we go.
Deploying io.js Applications In this short module, I just wanted to put everything together and make a small application that uses io. js and some ECMAScript 6 features like let just to prove a point and push it to Heroku to run it online. In order to do so, we'll need to make sure that we're using all the things we learned so far in a structured manner. This will also serve as a summary of the entire course. Note that not all Platform as a Service supports io. js, but Heroku does, so let's use that. Probably others too, but I happen to like Heroku. This is not a course on how to configure Heroku or your environment for a smooth Heroku deployment, so I go over that very briefly and just mention it. I have changed an old application written in Koa for Node. js to use the let statement, which forces us to use ECMAScript 6. Being a Koa application, it already uses generators and yield, so it's pretty ECMAScript 6 already. In order to run this smoothly, I've created two commands under my scripts node, test and start. Let's take a closer look at those. Notice the flags and configuration that they are currently using that is needed to run Koa applications under Node.