Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README example does not work #18

Closed
dbkaplun opened this issue Nov 24, 2015 · 3 comments
Closed

README example does not work #18

dbkaplun opened this issue Nov 24, 2015 · 3 comments

Comments

@dbkaplun
Copy link

var feathers = require('feathers');
var hooks = require('feathers-hooks');
var knex = require('feathers-knex');

// Initialize a MongoDB service with the users collection on a local MongoDB instance
var app = feathers()
  .configure(hooks())
  .use('/users', knex('users', {
    dialect: 'sqlite3',
    connection: {
      filename: './data.db'
    }
  }));

app.lookup('users').before({
  create: function(hook, next) {
    hook.data.createdAt = new Date();
    next();
  },

  update: function(hook, next) {
    hook.data.updatedAt = new Date();
    next();
  }
});

app.listen(8080);

Output:

TypeError: app.lookup is not a function
    at Object.<anonymous> (/Users/dan.kaplun/euclidsnap/server.js:15:5)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:136:18)
    at node.js:972:3
@daffl daffl closed this as completed in af51d61 Nov 24, 2015
@daffl
Copy link
Member

daffl commented Nov 24, 2015

It's app.service not app.lookup, I fixed it in the readme. Sorry about that, we're still in the process reviewing all the adapter docs and making sure everything works as described (.lookup was the pre Feathers 1.0 name for .service).

@dbkaplun
Copy link
Author

I understand. I think the feathers-knex adapter is your most important adapter. Keep up the good work!!

@daffl
Copy link
Member

daffl commented Nov 25, 2015

Thanks and that's good to know. Let us know if you run into any other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants