1couchnode - node.js access to libcouchbase
2==========================================
3
4This library allows you to connect to a Couchbase cluster from node.js
5
6Basic installation and usage
7--------------------
8
9To install this module, we'll assume you are using [NPM](https://npmjs.org).
10However it is not as simple as a regular JavaScript module,
11as it depends on the C-library for Couchbase clients,
12[libcouchbase](https://github.com/couchbase/libcouchbase). Libcouchbase
13also powers other dynamic language clients, such as Ruby and PHP, so
14if you've worked with those clients you should feel right at home.
15
16First step is to install libcouchbase (the 2.0 version). On a Mac
17with homebrew this should be as easy as running:
18
19    brew install https://github.com/couchbase/homebrew/raw/preview/Library/Formula/libcouchbase.rb
20
21Once you have libcouchbase installed, you can proceed to install the
22`couchbase` module by running:
23
24    npm install couchbase
25
26Do note that this module requires the very latest version of
27libcouchbase, so if you see errors like `error: ‘struct lcb_io_opt_st’
28has no member named ‘v’`, you may have to install libcouchbase from
29source until we cut another release.
30
31
32API description
33---------------
34
35For API illustration, the best bet at the current time is [a small
36example http hit
37counter](https://github.com/couchbase/couchnode/tree/master/example.js). There
38is also [the test suite which shows more
39details.](https://github.com/couchbase/couchnode/tree/master/tests)
40
41    get:       cb.get(testkey, function (err, doc, meta) {})
42    set:       cb.set(testkey, "bar", function (err, meta) {})
43    replace:   cb.replace(testkey, "bar", function(err, meta) {})
44    delete:    cb.delete(testkey, function (err, meta) {})
45    multiget:  cb.get(['key1', 'key2', '...'], function(err, doc, meta) {})
46
47
48Contributing changes
49--------------------
50
51See CONTRIBUTING.md
52
53Install description
54-------------------
55
56You would need to have libcouchbase installed _before_ you can build
57the node extension. If you have installed libcouchbase in a location
58that isn't part of the default search path for your compiler, linker
59and runtime linker, you have to set the appropriate flags. ex:
60
61    EXTRA_CPPFLAGS="-I/opt/local/include"
62    EXTRA_LDFLAGS="-L/opt/local/lib -Wl,-rpath,/opt/local/lib"
63