Deploying Node Apps with Spark
This article will go through building a simple RESTful key/value store using Connect. Then I'll explain my favorite way to host apps on Ubuntu Server. This will use upstart and Spark. We'll setup the node.js environment using the super easy Ivy distribution.
Read more...Why use "closure"?
One of the greatest features of the JavaScript language is closure. I've discussed this concept some in the "What is This?" article. There I was explaining scope and context. Today I wish to explain about some practical uses of a closure in event based programming as well as compare it to other methods like object orientation to preserve state across event calls.
Read more...Just Connect it Already
Now that the core APIs of node are really starting to stabilize, I'm moving my attention to helping stabilize the framework scene. One of the things I found really neat from Ruby was the Rack server interface. It allowed any server that followed the spec to host any app that followed the spec. Also (and this is the important part for node) is allowed for generic middleware libraries to do common tasks and functions in a very aspect oriented manner.
My employer, Sencha, has sponsored TJ Holowaychuk and I to write a middleware system for node called Connect in an effort to foster common development in the node community.
UPDATE This article has been updated to use the new connect middleware API.
Read more...Creating Custom Modules
Node implements CommonJS Modules 1.0. Node's full API doc. explains their use thoroughly, but can be a bit tricky to get started.
This tutorial explains the why and how you can use Node's module system to help structure your application.
Read more...Volcano Wheat
Announcing the release of a new engine for howtonode.org, Wheat! Also in honor of those stuck in Europe trying to get to jsconf, the background is a photo of the icelandic volcano.
Read more...The Step of the Conductor
There have been several async management libraries proposed and written. I'm guilty of at least three of them. The reason for this proliferation of code is that they're all trying to solve a very real problem with writing non-trivial applications that make heavy use of async callbacks.
Read more...Hello Node!
In programming literature it has become the standard to create a hello world program as the first example. This article will go through a few simple hello world type examples with everything from simple terminal output to an http server that uses an external framework for some semantic sugar.
Then we'll shift gears and go through a real example that teaches enough to get you up on your feet writing your own web application using node.JS.
Read more...Facebook Connect with Node
A big part of building a new web application is repurposing common patterns, one such pattern is the ability for users to sign in and out. One way of solving this quickly is by using Facebook Connect.
Read more...What is "this"?
Most people that learn JavaScript are coming from a background in another language. This brings with it a view of how the world works that may be different from how it really works in JavaScript. For this and other reasons, JavaScript is often misunderstood. It's not entirely our fault, the language was designed to work like one thing (scheme-like), but look like another (c-like). This article will describe lexical scope and the "this" variable and how to control them rather than be controlled by them when in coding JavaScript.
Tasks and Prompts -- Implementing Simple Work Queues
Sometimes all you really need is orderly execution not blocking I/O to get the job done. Tasks and prompts is a light weight implementation of the work queue design pattern.
Read more...Node + Redis = Fun
node brings asynchronous, evented I/O to the server. Redis gives you a blazing fast database with support for strings, lists and sets. Both Redis and Node.js follow certain patterns, Redis for data-storage, and node for event based programming. I hope to give an introduction to both in this article. By the time we are done, we will have built a Pastebin service.
Read more..."Do" it fast!
Now with the release of Node v0.1.30 there is even more need for a library like Do. While working with the node community to decide on the best alternative to node promises, we decided that it's best left to library developers. So as of this morning, node no longer ships with promises, but uses a simple callback interface for all async functions.
I took my async library that I've been developing throughout the Control Flow series and made it into a real library called Do.
Read more...NodeJS for everyday things
Everyday things:
Read more...Those little programs you write quickly to get something done like counting pages in a text document.
Blog rolling with mongoDB, express and Node.js
In this article I hope to take you through the steps required to get a fully-functional (albeit feature-light) persistent blogging system running on top of node.
The technology stack that we'll be using will be node + express + mongoDB all of which are exciting, fast and highly scalable. You'll also get to use haml-js and sass.js for driving the templated views and styling! We will be using kiwi to easy the package management and installation issues.
This article will be fairly in-depth so you may want to get yourself a rather large mug of whatever beverage you prefer before you settle down :)
Read more...Control Flow in Node Part III
While working on my quest to make async programming easier, or at least bearable, I discovered that often in programming you work with a set of data and want to do things on all the items in that set at once.
This article will explain a way to do async filter and map functions where the callback to map or filter is an async operation itself. I will compare the simple task of reading all the files in a directory into memory in both sync and async style programming.
UPDATE This article has been heavily updated to use callbacks and new node APIs. See the past revisions in the panel to the right for the original Promise/Continuable based article.
Read more...