How do I avoid cross-domain issues accessing node.js using AJAX?

I am using node.js with express, jade and sass for my application. I have a couchdb database and I would like to use this using AJAX. Normally, to access couchdb with AJAX you would create a document in the database and attach the html file to it, so that it is served from the same domain. However, most of the site will be generated using templates served by node.js, which means being served from a different domain to couchdb's server. How do I get round this?

You need to enable cross-domain communication in express, please check this answer: Using Express and Node, how to maintain a Session across subdomains/hostheaders

As well you might consider of using jsonp for most browser support. In order to enable it just add this line:

app.set('jsonp callback', true);

To your app.configure in express.
And then when you send answers use this method:

res.jsonp({ some: 'data' });