mardi 14 février 2017

Getting Error while using EmberJS and PouchDB

I'm trying to use EmberJS and PouchDB in very basic electron application but I keep getting an error that is preventing my views from loading. The issue only happens when I try to load a model in a route.

If anyone can point me in the right direction that'd be great.

Error:

Error while processing route: index Cannot find module 'test-app/adapters/application' Error: Cannot find module 'test-app at Module._resolveFilename (module.js:455:15)
at Function.Module._resolveFilename 

Here is my app/adapters/application

import { Adapter } from 'ember-pouch';
import PouchDB from 'pouchdb';
import config from 'browning-farms/config/environment';
import Ember from 'ember';

const { assert, isEmpty } = Ember;

function createDb() {
  let localDb = config.localDb;

  assert('emberPouch.localDb must be set', !isEmpty(localDb));

  let db = new PouchDB(localDb);

  if (config.remoteDb) {
    let remoteDb = new PouchDB(config.remoteDb);

    db.sync(remoteDb, {
      live: true,
      retry: true
    });
  }

  return db;
}

export default Adapter.extend({
  init() {
    this._super(...arguments);
    this.set('db', createDb());
  }
});

Here is /routes/index.js

import Ember from 'ember';

export default Ember.Route.extend({
  model() {
    return this.get('store').findAll('inventory');
  }
});




Aucun commentaire:

Enregistrer un commentaire