N1Ql with Angular 2 and pouchdb sample

Hi all,
I’m traying to use N1QL, couchebase with angular 2 and pouchdb, but got this error :
=> var couchbase = require(‘couchbase’);
error => ERROR in /Users/mac/Documents/projets/TestN1ql/src/app/app.component.ts (4,17): Cannot find name ‘require’.

any sample project, tutorial or idea?

Thanks for help

Hi @abid.kh,

The JavaScript SDK for Couchbase is for server-side Node.js only. While your error is unrelated, The Node.js SDK will not work directly in an Angular project.

You might have a look at this Angular with PouchDB guide that I wrote:



hello Nic, thanks a lot for reply.
is there any way to use N1QL inside angular 2?
in fact, i’m trying to combine between pouch and n1ql.

The Query service does have a REST API on port 8093, which you could call directly, though most web applications are not permitted to call services on another host/port. I worked around that issue in one application by having the program serving up the application proxy requests to the Couchbase query service.

Can you describe in more detail what you’re trying to accomplish, and what the system architecture is like?