且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

回送会话是否没有方法创建?

更新时间:2023-11-10 18:50:22

您似乎正在使用旧版本的LoopBack.尝试升级并确保用户模型已附加到数据源.以下是执行此操作的步骤.

It looks like you are using an old version of LoopBack. Try upgrading and making sure the user model is attached to a data source. Below are the steps to do this.

// # Verify version
// Ω slc version
// slc v2.1.1 (node v0.10.9)
// # upgrade with `npm install strong-cli -g`
// # create a simple project
// Ω slc lb project hello-user
// Ω cd hello-user
// # create hello-user/models/user.js
var user = require('app').models.user;
var credentials = {
  email: 'foo@bar.com',
  password: 'password'
};

user.create(credentials, function(err) {
  user.login(credentials, function(err, accessToken) {

    console.log(accessToken);

    // { userId: 1,
    //   ttl: 1209600,
    //   id: 'nt2KN4N5p3QbxByypRiHlduavxCRJUPbcStWPfxgrWYU8JllryjUp028hlJAFx4D',
    //   created: Tue Jan 14 2014 08:26:22 GMT-0800 (PST) }

  });
});