My attempt at a challenge problem using node.js