Talk to CouchDB API via template

Hey guys,
I’m using NodeJS and a Handlebars template to render images which are stored on a remote CouchDB which needs authentication.

My question is, is there any way to talk to the CouchDB API in my template?

Currently I’m trying this:

    {{#each this.doc._attachments}}
            <img src="<URLtoRemoteDB>/<doc_id>/picture.jpg">

If your question is really about CouchDB, you’re probably better off asking in another forum or on StackOverflow. This forum is for Couchbase.

But if you’re asking about Couchbase, I don’t think you can talk directly to the Couchbase REST API from your client-side code. You’d have a CORS problem (at least), and it would be a potential security risk. You’d be better off making requests to some REST framework (like Express), which would then make requests on the server-side to Couchbase Server.