Skip to content

Store.open doesn't find the store #24

Open
@kevinmerckx

Description

Hi Hoodie team,

I've manually set up Hoodie with a Node script.

const Hapi = require('hapi');
const hoodie = require('hoodie').register;
const PouchDB = require('pouchdb-core')
  .plugin(require('pouchdb-find'))
  .plugin(require('pouchdb-replication'))
  .plugin(require('pouchdb-mapreduce'))
  .plugin(require('pouchdb-adapter-fs'))
  .defaults({
    prefix: '.hoodie/data/'
  });
const Store = require('@hoodie/store-server-api')(PouchDB)
  
const server = new Hapi.Server()
server.connection({
  host: 'localhost',
  port: 8080
});

server.register({
  register: hoodie,
  options: { // pass options here
    inMemory: false,
    public: 'dist',
    PouchDB: PouchDB
  }
}, function (error) {
  if (error) {
    throw error
  }

  server.start(function (error) {
    if (error) {
      throw error
    }

    console.log('Server running at:', server.info.uri);
    // HERE I want to do some task with the users' stores
    Store.open('userXXXYYYZZ'); // DOES NOT WORK

  })
});

Everything's fine client side. I'd like to work on the databases to replicate data and do some server side tasks. I tried to open a user's store given its id but it always fails with Missing: Store does not exist. I use the fs adapter and I do see the files! Is there something I'm missing?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions