io.js and Node.js Next: Getting Started

Get started running your Node.js applications on io.js. io.js is the foundation of the next version of Node.
Course info
Rating
(68)
Level
Intermediate
Updated
Jun 4, 2015
Duration
42m
Table of contents
Description
Course info
Rating
(68)
Level
Intermediate
Updated
Jun 4, 2015
Duration
42m
Description

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.

About the author
About the author

Get agile to work in practice - is my motto. This had led me to take interest in all kinds of things: Lean, TDD, Kanban, Specification by example, Node, Continuous Deliver, Nancy and Koa.

More from the author
Introduction to npm as a Build Tool
Beginner
1h 37m
Oct 20, 2015
Introduction to Koa Javascript
Intermediate
2h 3m
Dec 12, 2014
Section Introduction Transcripts
Section Introduction Transcripts

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.

Summary
And that brings us to the end of the course. The reason to use io. js is stated directly on their website, bringing ECMAScript 6 to the Node community. In this course I have shown you how to use io. js. There are some quirks and problems that you have to get around, but for now I just wanted to reassure you that you can control the features you enable for io. js with flags. Mostly it means no flags at all. And remember that we should not use the in progress features in production since they will change a lot. For the most part, your current Node applications will just work under io. js as well. The differences are not that big in the platforms. I think there's no better time than now to get your feet wet and start running io. js. And, as always, you'd be surprised how much you will learn about Node and JavaScript by extending your knowledge a little bit beyond your comfort zone, even if you never actually used the edge cases that we talked about here. Thank you so much for listening. See you out there.