阅读背景:

如何使用feat js身份验证将客户端连接到服务器?

来源:互联网 

this is my server.js:

这是我的server.js:

app.use('/users', {
    find(params) {
      return Promise.resolve(Users);
    }
  });
  app.service('authentication').hooks({
  before: {
    create: [
      auth.hooks.authenticate(['local', 'jwt'])
    ]
  }
});
app.service('users').hooks({
  before: {
    create: [
      local.hooks.hashPassword()
    ]
  }
});
/////////////////
app.post('/login', auth.express.authenticate('local', { successRedirect: '/app', failureRedirect: '/login' }));

app.get('/app', (req, res, next) => {
  res.json({ success: true });
});

app.get('/login', (req, res, next) => {
  res.json({ success: false });
});
//////////////
app.us



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: