How to use the pouchdb.debug function in pouchdb

To help you get started, we’ve selected a few pouchdb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jonniespratley / angular-cms / routes / cms-router.js View on Github external
module.exports = function(config, app) {
	'use strict';
	var router = express.Router();
	router.use(function(req, res, next) {
		console.log('cms-router Time:', Date.now());
		next();
	});

	//Fix for cloud foundry
	if (process.env.VCAP_APP_PORT) {
		config.port = process.env.VCAP_APP_PORT;
	}

	// TODO: Using pouchdb
	var PouchDB = require('pouchdb');
	PouchDB.debug('*');
	var db = new PouchDB(config.db.local);
	var db2 = new PouchDB(config.db.remote);
	PouchDB.sync(db, db2);
	app.locals.db = db;

	console.log('Connected to', config.db.local);

// TODO:

/*
router.route('/users/:user_id')
.all(function(req, res, next) {
  // runs for all HTTP verbs first
  // think of it as route specific middleware!
  next();
})
github jonniespratley / angular-cms / routes / rest.js View on Github external
//Strings for results
var MESSAGES = {
	USER_REGISTRATION_ERROR: 'There was an error, please try again.',
	USER_REGISTRATION_SUCCESS: 'New user successfully registered.',
	USER_REGISTRATION_EXISTS: 'User already in exists.'

};
var config = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../config/config.json')));



// TODO: Using pouchdb
var PouchDB = require('pouchdb');
PouchDB.debug('*');
var db = new PouchDB(config.db.local);
var _ds = {
	findOne: function(id, params) {
		return db.get(id, params);
	},
	findAll: function(params) {
		return db.allDocs(params);
	},
	create: function(id, data) {
		return db.put(data, id);
	},
	update: function(id, data) {
		return db.get(id).then(function(resp) {
			data._rev = resp._rev;
			return db.put(data, id);
		})
github alexcheninfo / vuejs-rethinkdb-example / src / store / index.js View on Github external
import PouchDB from 'pouchdb'
import _ from 'lodash'

const db = new PouchDB('vuedb')
const remotedb = new PouchDB('http://localhost:5984/vuedb')
const store = {}

PouchDB.debug.disable()

store.create = data => {
  return db.post(data)
}

store.find = () => {
  return db.allDocs({include_docs: true})
}

store.findProjects = () => {
  function map (doc, emit) {
    if (doc.type === 'project') {
      emit(doc.createdAt)
    }
  }
  return db.query(map, {include_docs: true}).then(projects =>
github muffin / server / app / adapters / application.js View on Github external
import PouchDB from 'pouchdb';
import { Adapter } from 'ember-pouch';

PouchDB.debug.enable( '*' );

var remote = new PouchDB( 'http://localhost:5984/muffin' );
var localDB = new PouchDB( 'muffin' );

localDB.sync(remote, {
  live: true,
  retry: true
});

export default Adapter.extend({
  db: localDB
});