2.3.6 • Published 7 years ago

ember-hoodie v2.3.6

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

ember-hoodie

Use hoodie seamlessly with Ember.js

Build Status Dependency Status devDependency Status

Installing

  • npm install -S ember-hoodie

Usage

// app/application/controller.js
import Ember from 'ember';
const {
  Controller,
  inject: { service }
} = Ember;

export default Controller.extend({
  hoodieAccount: service('hoodie-account'),

  actions: {
    signIn(username, password) {
      this.get('hoodieAccount').signIn({username, password});
    },

    signOut() {
      this.get('hoodieAccount').signOut();
    }
  }
});

and in your application serializer

// app/serializers/application.js
import DS from 'ember-data';

export default DS.JSONSerializer.extend({
  shouldSerializeHasMany: function() {
    return true;
  },
  primaryKey: '_id' //hoodie generates _id
});
// app/services/store.js
import HoodieStore from 'ember-hoodie/services/store';

export default HoodieStore;

If you want ember server to start the Hoodie Server for you, you have to configure ENV.hoodie.server.

// config/environment.js

var PouchDB = require('pouchdb');

if (environment === 'development') {
  ENV.hoodie = {
    client: {
      url: 'http://localhost:4200'
    },
    server: {
      PouchDB: PouchDB,
      paths: {
        public: 'dist'
      }
    }
  }
}

The ENV.hoodie.server property is the exact hoodie-server config that will be passed as hapi's register options. So you can pass whatever options you need here. For example, to make hoodie act as a proxy to a couchdb, you can use:

  ENV.hoodie = {
    client: {
      url: 'http://localhost:4200'
    },
    server: {
      PouchDB: PouchDB.defaults({
        prefix: 'http://localhost:5984',
        auth: {
          username: 'admin',
          password: 'admin'
        }
      }),
      port: 4201,
      paths: {},
    }
  };

Now, you can just use the store as you are used to! Whabam! Please help me fill out these docs a little better.

Hacking locally

  • git clone this repository
  • npm install
  • bower install
2.3.6

7 years ago

2.3.5

7 years ago

2.3.4

7 years ago

2.3.3

7 years ago

2.3.2

7 years ago

2.3.1

7 years ago

2.3.0

7 years ago

2.2.3

7 years ago

2.2.2

8 years ago

2.2.1

8 years ago

2.2.0

8 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.0

8 years ago