Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/richardbolt/koa-couchbase

Koa middleware for couchbase - adds this.couchbase to the context.
https://github.com/richardbolt/koa-couchbase

Last synced: 11 days ago
JSON representation

Koa middleware for couchbase - adds this.couchbase to the context.

Awesome Lists containing this project

README

        

koa-couchbase
=============

Koa middleware that gets you a Couchbase client.

This extends Koa by adding `this.couchbase`.

Usage
-----

```javascript
var koa = require('koa');
var couchbase = require('koa-couchbase');

var app = koa();

var options = {
dsn: 'localhost',
bucket: 'default',
username: 'my-username',
password: 'my-password'
};

app.use(couchbase(options));

app.use(function *(next) {
// Here we have access to this.couchbase which is a connection to your bucket.
var result = yield this.couchbase.get('document-id');
this.body = result.value;
})

app.listen(3000);
```