
Thank you for joining this comprehensive course on NodeJS. I'm delighted to have you here. This video explores NodeJS from its fundamental concepts to its use case scenarios as well as establishes reasons why its becoming one of the hottest technologies to master.
NodeJS 4.x has brought native support for ECMAScript 6, out in the wild. So, here's a free eBook for everyone to get up and running with ECMAScript 6 today!
Since this course is being upgraded, all new lectures will support ES6. So, do read this work in progress document.
Also present is an Update Log that will keep you upto speed on the status of the course revision process.
In this video, we will download and install NodeJS on our Windows PC. To download NodeJS go to www.nodejs.org
In this video, we will download and install NodeJS on our Mac. To download NodeJS go to www.nodejs.org
There are many ways of installing NodeJS on Linux. In this screencast, we'll use the Node Version Manager - N to install NodeJS and npm on Ubuntu.
NodeJS provides an interactive terminal/shell based coding environment called R-E-P-L which stands for Read-Evaluate-Print-Line. A REPL interface executes one line or a code block at a time and hence is interactive. We can use Node's REPL for quickly experimenting with code.
In this lecture, you'll learn how to write your very first app with NodeJS - A Server that prints Hello NodeJS in the browser.
Routing refers to handling requests from users. In this lecture, we'll understand how requests and responses work in NodeJS and we'll take our first steps at understanding the process of routing.
In this screencast, we begin by writing a router that can handle GET requests.
Our router graduates up to handle POST requests in this screencast.
So how exactly do the requests and responses work in NodeJS?
How about writing a web server that serves a static HTML website!
It is very easy to write badly tangled up asynchronous code. So, let's detangle right away using Promises.
Streams is an amazing feature. Know all about it, in this screencast.
Modules help break down a bigger app into manageable chunks. In this screencast, you'll use an existing module to write an app that generates QR Codes. And we get to use NPM!
Finally, we get to write our very own module.
MongoDB is a NoSQL database that stores data as documents in a format similar to JSON instead of using tables with rows and columns such as in a traditional RDBMS like MySQL MongoDB is schema-less which is pretty awesome for modern day product development lifecycles that need to be very dynamic and flexible. In this video, you'll be introduced to MongoDB.
Though we will be using a hosted MongoDB Implementation for our production examples in this course, in this video, we will download the MongoDB installer for Windows and we'll set it up to run as a windows service.
Here's how to install MongoDB locally on a Mac. For Mongo Shell and basic commands, refer to Lecture 10.
In this screencast, we'll play with the MongoDB Shell, a command line based interface to MongoDB, also based on the Chrome V8 engine.
PhotoGRID is a photo gallery app that we'll build using NodeJS. We will build this app based on technologies that we've learnt so far and we'll take our experience one notch higher by integrating & deploying our app on the Amazon Elastic Compute Cloud (EC2). We will also use a couple of other AWS Services like the S3 Storage Service, Elastic IP & Cloudfront.
This document should be read properly to avoid potential problems with this chapter.
As in the ChatCAT example, the User Interface files have been provided. We'll examine the user interface in this video.
In this video, we'll download Express 4.0 - one of the most popular frameworks for making NodeJS apps. Once done, we'll create a basic scaffold for a working Express app. We'll also install SocketIO & Hogan-Express modules as well.
In this video, we'll create a Routes module like how we created in the ChatCAT example.
In this video we'll create configuration files and a module to manage development and production environments.
Amazon is the global leader in Cloud Computing Services. In this video, we'll signup for an account on Amazon Web Services and we'll begin by provisioning an S3 (Simple Storage Service) Bucket to store all the photos that the user uploads via PhotoGRID.
Access to an Amazon S3 Bucket depends on a bucket policy, without which users would be unable to access files. In this video we'll create a bucket policy.
To enable our PhotoGRID app to interact with the Amazon S3 Bucket, we'll use the KnoxJS module. In this video we'll download and setup the KnoxJS module.
In this video, we'll prep our front end to transfer files using a custom built AJAX function. Instead of using jQuery or similar libraries, we'll cook our own AJAX function.
Once the Javascript on the front end UI sends the file using AJAX, we'll use the Formidable module to receive the files within the NodeJS app. In this video we'll download and setup Formidable so it is able to receive files.
Before we put uploaded images into the S3 bucket, we will resize them down to a width of 300 pixels. To achieve that, we'll use the GraphicsMagick Image Processing Library along with the gm module in NodeJS which will interact with GraphicsMagick to resize the images.
In this video we'll write code which uploads files after they've been resized using GraphicsMagick to the S3 bucket using the Knox module.
In this video, we'll create a MongoDB database on MongoLab and we'll store the name of our file and the initial vote count in a collection. Additionally we'll also delete the image file as locally stored on the server during the resizing process.
As Photos are uploaded, the gallery portion of our PhotoGRID website should also update to reflect all images.
Since we're serving image files from our S3 bucket onto our PhotoGRID gallery, we need to optimize S3 for delivery. This can be done by using Amazon's CloudFront service which turns our S3 bucket into a Content Delivery Network (CDN) that is optimized for delivery.
PhotoGRID also incorporates a vote-up functionality that lets users upvote images that they like. I've kept the functionality very simple and as a matter of fact it allows you to keep clicking to increase the vote count which is unlike how it would be in a production case scenario. However, this should whet your appetite enough to build a more practical version of the vote-up functionality. We'll also test our app so its ready for deployment.
An Amazon Elastic Compute Cloud Instance (EC2) is a server in the cloud that you can easily instantiate and setup. It comes with an OS of your choice with full root access to let you install, and setup virtually anything. In this video, we'll spin up our EC2 instance in preparation for deploying our NodeJS App.
To run NodeJS apps, we need to install NodeJS on our EC2 instance. This video shows you how.
So far we've been accessing the EC2 instance using a public DNS which can change if the server is restarted. To ensure we're able to access the server, we'll setup an Elastic IP which binds our server to a fixed IP address. This ensures that even if we restart our EC2 instance, we would still be able to access the server using the fixed IP provided to us by Elastic IP.
And the big moment arrives when we finally deploy the PhotoGRID app on our EC2 instance !
Before we can access the NodeJS app, we need to setup our security group, open ports and ensure that Port 80 (HTTP) forwards to our PhotoGrid NodeJS App typically running on Port 3000.
Important :: It should be noted that practically speaking, we should use NGINX Web Server as a front facing server that routes requests from Port 80 to Port 3000 on the NodeJS app through reverse proxying requests. This is demonstrated exclusively in the next section in this course. For now, I've kept the deployment easy to understand by simply forwarding Port 80 to Port 3000.
Imagine a situation where your EC2 instance reboots. This would mean that the NodeJS app would not come back online since so far we've been launching it manually from the terminal. We'll correct this in this video by making sure the app runs automatically when the server starts up.
Cloud9 combines a powerful online code editor with a full Ubuntu workspace in the cloud.
Digital Ocean has become the third fastest growing Cloud Hosting provider in the world and is competing directly with the biggies such as Amazon. Digital Ocean has been designed with developers in mind and gets you up and running in no time with no complexity involved at all.
NGINX is a super fast Web Server, Proxy Server and a Load Balancer, all rolled into one. By placing NGINX infront of your NodeJS apps, you can deliver static assets such as images, css files and javascript files directly without routing them through the Node app which negatively affects performance. In this video, we'll install NGINX on our Digital Ocean server instance (Droplet)
By using NGINX as a reverse proxy server for our NodeJS app, we get optimum performance because NGINX takes over serving static files including caching.
In this video we'll install our good old ChatCat on the Digital Ocean Server using NGINX as a reverse proxy. Download the accompanying archive that contains a slightly modified ChatCAT App that is ready to be installed on the Digital Ocean instance.
A Load Balancer distributes the incoming user traffic over a cluster of servers so as not to overload a single server instance. NGINX is a terrific load balancer that is super easy to configure. In this video, I'll show you to how to configure NGINX when using it as a Load Balancer.
Enterprise integration refers to the process of getting software across a gamut of platforms and servers to talk and share data with each other.
In this video, we'll setup base and foundation for an example Node.js app that we'll write in this section that demonstrates interoperability between a Node.js app and a Python script. This is going to be purely for demonstration purposes only and this process can be adapted to any scenario.
This section uses a provided Python script. This video shows you to how to set it up on a Mac (OS X Yosemite)
Apache Apollo is the next generation of Apache ActiveMQ, one of the most popular message queue solutions out there. In this video, you'll learn how to set it up on a Mac (OS X Yosemite)
Once installed, we'll configure Apache Apollo to create our users and designate queues or channels which will carry our data to and from the Python script.
Hapi is an amazing enterprise grade Node.js framework from Walmart Labs.
Set up your first app using the Hapi framework.
More about arrow functions on Youtube : Coming up on Monday, 5th October.
In this video, you'll setup your core plugin which will contain all the functionality and routes related to this app.
Our good old Socket.io is always there. Learn how to set it up with Hapi.
In this video, we'll setup the Stomp client which will enable our Hapi app to talk to Apache Apollo. We'll also learn how to use dot files to store access credentials including how to do it in the correct way.
The only button in our app can be enabled or disabled based on the state of the app and data. This video shows you how.
Before you dive into code and nail down the core function of this app, try and understand how it works in the first place.
In this video, we'll code our app's core functionality.
In this video we'll fix a tiny issue which occurs when the user refreshes the page in the browser after we've received all the data back from Apollo.
Logging and Process Monitoring is essential for server level apps. In this video, we'll examine how Hapi plugins allow you to log events and errors to a file.
Thank You :)
About this Course
NodeJS is a platform that allows developers to write server side high performance and networked applications. And that too using good old Javascript. But wait ! Isn't Javascript meant to be used for forms and stuff on web pages ?
Well that was 10 years ago. The world has gone from 'Oops! You've not filled up the form properly !' days to today's modern web apps and social media sites that rely heavily on Javascript. Google Apps, Facebook, Twitter, Google Plus and LinkedIn, being handful examples of this movement. And to think that this quantum leap would not have been possible without Javascript is not an overstatement. Today, when you socialize with your friends on Facebook, or use your Gmail inbox, you're running thousands of lines of code written in Javascript, in your browser.
With Node JS, you can take this knowledge back on the server, where usually you would expect to see the likes of PHP, Ruby, ASP dot NET etc. But that's only a small portion of the reason why NodeJS is so cool. The fact that you can write full blown networked applications (think chat servers, collaborative tools, real-time data visualisation apps) with just a few lines of code is more than reason enough to not only look at NodeJS, but deep dive into it !
But I know PHP ? Why should I learn NodeJS ? Well, for starters, learning something new never hurts. But most importantly, learning NodeJS is great because :
The Real Problem
So, NodeJS sounds pretty interesting so far, but what really hit me in the face when I was learning all about Node was the fact that, with any new platform, framework or technology, you need to take baby steps, all the way through, to making real world examples, if you have to get to the grips of it. And that leads us to why you're here.
In this course, we'll go from absolute scratch, all the way up to building and deploying full blown NodeJS app on the Cloud !
Project Oriented Learning
With NodeJS, we will build two full blown apps. We will go all the from concept creation, UI/UX design to coding and deploying our app on the cloud.
A. ChatCAT - One of the fun things that you can do with NodeJS is build realtime apps that allow a high number of concurrent users to interact with each other. Examples of this kind include Chat Servers, Gaming Servers, Collaborative Tools etc. We will build a multi-room chat server that allows users to login via Facebook, Create Chatrooms of their choice and Chat in realtime. We will not only create this app, but also deploy it on Heroku and Digital Ocean !
You will learn all about using Websockets, Structuring your App in an efficient manner, creating and using development & production configurations, Authentication using Facebook, Setting up an App on Facebook, Managing Sessions, Querying & Using a Hosted MongoDB Database, Using Heroku & Digital Ocean's Cloud Services and lots more...
B. PhotoGRID - The second complete app that we will build in this course is a Photo Gallery app which lets users upload images into a gallery with the ability to vote up the images that they like. This NodeJS app lets users upload files, which are then resized to thumbnails on the server and stored in an Amazon S3 Bucket for optimal delivery to the front end interface. The entire app runs on an Amazon EC2 Cloud Server which we will create from scratch and configure for use.
You will learn about managing file uploads using NodeJS & AJAX, Resizing Images on the Server, Accessing & Storing files in an S3 Bucket, Querying & Using a Hosted MongoDB Database, Using Amazon's Elastic IP Service & Cloudfront distribution, ensuring your NodeJS app runs automatically even if the server is restarted and lots more...
In the projects above, we leave no stone unturned in terms of execution. This is a complete hands-on course that is not just limited to NodeJS but to the ecosystem that needs attention when a NodeJS app is built and deployed. My intent is hand hold you all the way from writing your first app to deploying production level apps on the cloud.
And I'm always available to personally help you out, should you get stuck.
BONUS :: Here's the best thing about this course. The curriculum that you see gets you up and running with NodeJS & Cloud Deployment. However, there is so much more that you can do with NodeJS, which is why I will keep adding new lectures and sections to this course on an ongoing basis. There is so much more that you will get with full lifetime access to lectures and all updates !!
So, join in the fun !