This is a simple example of using node.js, nano (couch db modules) and the express framework to retrieve some data from a couch instance.

Setting up the modules

We will be using a couch instance from www.iriscouch.com. The database will be named “employees”.

We need to include the express module and create an express server:

With all modules setup it should look like this.

We need to give express access to the imgs, css and js directories so it can retrieve our assets.

Setting up a route

We are setting up a route to “all” that will call a view from the couch instance and retrieve some data.

Starting sever

Point your browser to http://localhost:3000/all. You should see a JSON object return like below. I only added 2 employees for the demo.

I will go over how to create a couch instance, create a view and add some data in another post.