background preloader

Node.js

Facebook Twitter

Meet the Connect Framework. Express - node.js web application framework. Hosting a Node app on Heroku. Note: I apologise for the lack of updates on JS Playground recently, but happy to announce the site is now returning to at least one post per week. Any requests for content, please get in touch. Today I want to look at using the popular Heroku to host a simple Node app. I got asked recently if I had any suggestions on hosting a small Node app, and Heroku's free plan is usually more than enough for little side projects, or to show off something you're working on.

It can be a bit daunting if you've never used it before, so I thought a step by step guide would be of use. This tutorial does require knowledge of Git and also you should be comfortable with the command line - if you're not then Heroku probably isn't for you. Heroku is heavily used to run Ruby / Rails apps but recently added Node.js support and it's a really great way to quickly and easily get something running online. If you haven't already, you'll need to sign up to Heroku, which is completely free. Nearly there! Real-Time Geolocation Service with Node.js. How Firm is Your Node.JS Foundation? Tim Caswell June 1, 2012 What is Node? Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications.

Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. Node Foundations I/O: Non-Blocking Network (UDP, TCP, HTTP) Disk State: Objects and Closures Control: Callbacks, Events, and Streams Organization: Interface Oriented Modules I/O Latency Compared Waiting Rooms - An Analogy What if node was modeled after CGI and used blocking I/O? Pros to blocking CGi style Simple: You can assume it's an HTTP request. Cons to blocking CGI style It's not flexible at all. What node code really looks like State Basic Objects In any node program there is the concept of state. JavaScript has objects that are used for storing internal state in named properties accessible via this.

Object Prototypes Object Constructors Closure Objects Control.