Nodejs receiving and modifying an html file callback from post request

I'm newish to nodejs and am having difficulty trying to come up with a solution to fully flush out the following:

  1. Make a form post request <- working
  2. data comes back as html <- working
  3. take data/html and createWriteStream 'stdout' to a file or save it to a DB (I was thinking redis since I only need the data TTL to be 15mins before rerunning the code. <- I have the data saved to HD, although i find this clumsy.
  4. Once i have the data/html file i need to use JS HTML DOM methods to yank specific table cell data and send to http server for the client to view. <- This is the part I cant get working.

Here is a link to my code: https://gist.github.com/bingeboy/6087474

I was missing the jsdom.jsdom method.

var jsdom = require("jsdom");

Needed to be:

var jsdom = require("jsdom").jsdom;

This allowed the window callback to load the file. Previously I was getting the file in the error cb. var fs = require('fs') , jsdom = require('jsdom').jsdom;

var htmlSource = fs.readFileSync(__dirname + "/date.html", "utf8")
  , document = jsdom(htmlSource)
  , window = document.parentWindow;

console.log(typeof window.document.getElementsByClassName); //function
console.log(window.document.getElementsByTagName('a')[1].innerHTML); //logs link text "311.json"