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 beta verion). 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 libcouchbase,
27so if you see errors like `error: ‘struct lcb_io_opt_st’ has no member named ‘v’`, you may have to install libcouchbase from
28source until we cut another release.
29
30
31API description
32---------------
33
34For API illustration, the best bet at the current time is [a small example http hit counter](https://github.com/couchbase/couchnode/tree/master/example.js). There is also [the test suite which shows more details.](https://github.com/couchbase/couchnode/tree/master/tests)
35
36    get:       cb.get(testkey, function (err, doc, meta) {})
37    set:       cb.set(testkey, "bar", function (err, meta) {})
38    replace:   cb.replace(testkey, "bar", function(err, meta) {})
39    delete:    cb.delete(testkey, function (err, meta) {})
40    multiget:  cb.get(['key1', 'key2', '...'], function(err, doc, meta) {})
41
42
43Contributing changes
44--------------------
45
46See CONTRIBUTING.md
47
48Install description
49-------------------
50
51You would need to have libcouchbase installed _before_ you can build
52the node extension. If you have installed libcouchbase in a location
53that isn't part of the default search path for your compiler, linker
54and runtime linker, you have to set the appropriate flags. ex:
55
56    CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib -Wl,-rpath,/opt/local/lib" node-waf configure
57
58To build and install the module, simply execute:
59
60    trond@ok> node-waf configure build install
61
62