nick-thompson/express-pouchdb — pull request #4 by ryanramage (2013-08-20 22:31:27+00:00)
Title: Export the pouch so apps that embed express-pouchdb can access this pouc...

...h.

I have just tried a few different ways of exposing the Pouch instance. This above is successful. Here is how you might use it in an app:

```
var express = require('express'),
express_pouchdb = require('express-pouchdb'),
Pouch = express_pouchdb.Pouch,
port = 15984,
app = express();

app.use('/_db', express_pouchdb);
app.use(express.static(__dirname + '/public'));
app.listen(port);

Pouch('leveldb://firstPouchapp' , function (err, db) {
if (err) return console.error('cant init db');
db.post({name: 'Ryan'}, function(err){

});
});

```

I have tried the following options, which all failed:

- in express-pouchdb, add app.set('pouchdb', Pouch) but app.get('pouchdb') was unset.
- Add a pouchdb dependency to the app project, and simply require('pouchdb'), but this creates the data files in node_modules/pouchdb/tmp/data and the express app stores the files in the root dir
- require('node_modules/express-pouchdb/node_modules/pouchdb') but like above this stores the files in that folder.

Anyway, the export seems a sane a clean approach.