Git Product home page Git Product logo

couchnode's Introduction

couchnode - node.js access to libcouchbase

This library allows you to connect to a Couchbase cluster from node.js

Basic installation and usage

To install this module, we'll assume you are using NPM. However it is not as simple as a regular JavaScript module, as it depends on the C-library for Couchbase clients, libcouchbase. Libcouchbase also powers other dynamic language clients, such as Ruby and PHP, so if you've worked with those clients you should feel right at home.

First step is to install libcouchbase (the 2.0 version). On a Mac with homebrew this should be as easy as running:

brew install https://github.com/couchbase/homebrew/raw/preview/Library/Formula/libcouchbase.rb

Once you have libcouchbase installed, you can proceed to install the couchbase module by running:

npm install couchbase

Do note that this module requires the very latest version of libcouchbase, so if you see errors like error: ‘struct lcb_io_opt_st’ has no member named ‘v’, you may have to install libcouchbase from source until we cut another release.

API description

For API illustration, the best bet at the current time is a small example http hit counter. There is also the test suite which shows more details.

get:       cb.get(testkey, function (err, doc, meta) {})
set:       cb.set(testkey, "bar", function (err, meta) {})
replace:   cb.replace(testkey, "bar", function(err, meta) {})
delete:    cb.delete(testkey, function (err, meta) {})
multiget:  cb.get(['key1', 'key2', '...'], function(err, doc, meta) {})

Contributing changes

See CONTRIBUTING.md

Install description

You would need to have libcouchbase installed before you can build the node extension. If you have installed libcouchbase in a location that isn't part of the default search path for your compiler, linker and runtime linker, you have to set the appropriate flags. ex:

EXTRA_CPPFLAGS="-I/opt/local/include"
EXTRA_LDFLAGS="-L/opt/local/lib -Wl,-rpath,/opt/local/lib"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.