express4 example app

A friend of mine is considering delving into the realm of Node.js, but he like a lot of people can't quite conceptualize how Javascript will run on the server despite having programmed in JS for years now. This seems to be fiarly common and admittedly when I first started using Node.js a couple of years ago I ran into the same problem.

So I figured I'd write a small little app in Express (the framework that helped me better understand how Node would work on the server), try to comment it heavily and share it with him. I decided a quick little app I could build with some persistence would be a url shortener app.

I didn't structure it like a production app, as I wanted to focus on functionality and explaining what exactly was going on and not have to burden anyone with having to open a lot of files. Though in the case of the Handlebars templates it was unavoidable.

The source is available here: for anyone looking to see a simple app. It's not perfect as I wrote it in a couple hours but hopefully those new to Node.js might find it a little useful to getting started.

I have a little demo running of it at but I give no warranty for how long it will be up and garauntee no quality of service since like I said, it's not meant for production :)