Category Archives: node.js

Simple static web server

Using Node.js & Express.js var express = require(“express”); app = express(); app.use(express.static(“.”)); var server = app.listen(80, function () { console.log(“Example app listening at http://%s:%s”, server.address().address, server.address.port); }); Advertisements

Posted in node.js, recipes | Leave a comment

Automating Chrome to download photos from Yahoo groups

The PTA at my kids school have been using Yahoo Groups to communicate for several years.   Over the years 1000s of photos have been uploaded to the group.   Yahoo groups doesn’t have a way to download photos in … Continue reading

Posted in node.js, recipes | Leave a comment

Using Fiddler with node.js on Microsoft Windows

The node.js request module supports proxies. There are a couple of different ways to enable this. I find this approach nifty as it doesn’t involve changes to the app or the app’s config. Open a Windows command prompt and type … Continue reading

Posted in node.js, recipes | 1 Comment

Node js running out of file descriptors

While splicing together several Javascript objects and applying business rules,  I realized it would be easier to write unit tests and validate the business rules if I serialized the object graph for each user to a separate file on disk. … Continue reading

Posted in node.js, SolutionBoundary | Leave a comment

Node.js recipe to pretty JSON

var file=process.argv[2].replace(/\\/g,’/’); require(“fs”) .writeFileSync(file, JSON.stringify(require(file), null, 2), {“encoding”:”utf8″} ); This only works when the file is valid json and the file has a .json extension.

Posted in node.js, recipes | Leave a comment