.JS – from Dust, to Node, and back again

A very tiny “node.js” example taken from the linked video is at the bottom of this post.

My favorite saying about myself is, “If there is a long way around the mountain, I usually find it and take it.” I think I over-complex things. While this isn’t always true, it does happen from time-to-time, and when it does, YIKES!  Long nights and stressed out manages usually ensue, with me meeting the deadline – barely – or coming in possibly a week beyond estimation.  (BTW: I hate estimating software project delivery, but that’s for a different post.)

This was beginning to be true for reading up on dust.js.

Dust.js, a rather nifty Javascript framework, has an online guide in two columns:

  • The Left side, a “How-To”, before you can even get going.  Pretty clear-cut.
  • The Right side, a “Let’s-Do”, with some references to Node.js.

Node.js is where I was getting stuck.  The instruction  that had me stumped was :

Then, within your Node script or the REPL:

var dust = require('dust');

I looked throughout the local install of Node.js on my local hard drive thinking, where on earth (rather, my hard-drive) is this ‘REPL’ file?  Mind you, Dust.js is my stated goal to understand.  Using Node was an assumed skill. 

Now we come to the purpose of this post:  IT Documentation drives my batty.  So many technologies are dependent upon one another, and understanding one primary tech requires the reader to pick up   n+   other technologies and have a reasonable understanding to proceed.  The guide authors of dependent technologies aren’t interested in rewriting the documentation published by each dependency. I GET IT.  But I have moments of being stuck looking into the techno abyss.  It’d be nice to have some bunny trail to follow, leading to the correct path of knowledge.

Nonetheless, I was able to circumvent the long path with a simple search on YouTube.com.  I came across a nice video of the Node.js creator doing a talk on his product.

So what is node? It is a server-side JavaScript engine running the Google Chrome V8 engine.

  1. Install it.
  2. Put the <install> folder in your path.
  3. Write a .js file like the following:


var http = require('http');
var s = http.createServer (function(req, res) {
    res.writeHead(200, {'content-type' : 'text/plain'});
res.end("hello world");
setTimeout(function() {


I quickly learned the “var” was to be for a server side JS file.  The video explains the rest – which is awesome since I am more a visual than just a book/written code learner.

So what is Dust.js?  Simply put – it is a template framework which boils a great many JavaScript commands into one command, and populates the front end through a JSON structure. Relatively slick at this point – But I’m just getting started.

As I dig into Dust.js I’ll be back out here describing some of what I see.  For now – it was good to conquer an understanding of Node.js.  Back to Dust.