erobit / hoodie-plugin-global-share

Hoodie plugin for sharing documents globally

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hoodie-plugin-global-share Build Status

Installation:

hoodie install global-share

Usage:

Assuming you have a running hoodie setup.

Create a few documents you'd like to make publicly available:

var docs = [
  {
    name: 'sleep'
  },
  {
    name: 'eat'
  },
  {
    name: 'sleep some more'
  }
];

hoodie.store.add('tasks', docs).done(function(newDocs) { ... });

Make all 'tasks' publicly available:

hoodie.store.findAll('tasks').publish();

or publish a single task:

hoodie.store.find('tasks', 'taskID12345').publish();

Same goes for unpublishing:

hoodie.store.findAll('tasks').unpublish();

hoodie.store.find('tasks', 'taskID12345').unpublish();

You can then read these documents from the hoodie.global store, logged in as any user (or not logged in at all).

hoodie.global.find('tasks').done(function(publicTasks) { ... });

Testing:

grunt

About

Hoodie plugin for sharing documents globally