Feathersjs:切换到套接字而不是 REST,使用带套接字的 Express 中间件

Feathersjs: Switching to sockets instead of REST, using Express Middleware with Sockets

所以我正在关注有关身份验证的 Feathersjs 文档,
我有一个中间件 /signup,
来自 User Management docs

module.exports = function(app) {
  return function(req, res, next) {
    const body = req.body;   
    app.service('users').create({
      email: body.email,
      password: body.password
    })
    // Then redirect to the login page
    .then(user => res.redirect('/login.html'))//this will be a redirect in my client not in the server      
    .catch(next);
  };
};

现在 src/middleware/index.js: 我有:

module.exports = function() {
  const app = this;

  app.post('/signup', signup(app));// how can I reimplement this with sockets
  app.use(notFound());
  app.use(logger(app));
  app.use(handler());
};

使用 REST 很简单:

request.post(`${SERVER}/signup`)
      .send({ email: username, password: password })
      .then(data=>{console.log(`data comming from response`,data)})
      .catch(error=>{console.log(`ERROR comming from response`,error)})  

所以问题是现在我正在使用套接字 (feathers-client) 我不知道如何告诉 feathers 客户端 "post" email/pass 到 /signup 中间件。有什么办法可以实现吗?
这是我的客户会议:

import feathers from 'feathers-client';    
const io = require('socket.io-client');
var socket = io(SERVER);


let feathersClient = 
  feathers()
    .configure(feathers.socketio(socket))
    .configure(feathers.hooks())
    .configure(feathers.authentication({
      storage: window.localStorage
    }));

您不需要注册中间件。只需在您的客户端上通过 /users 服务创建一个新用户,如下所示:

import feathers from 'feathers-client';    
const io = require('socket.io-client');
var socket = io(SERVER);


let feathersClient = 
  feathers()
    .configure(feathers.socketio(socket))
    .configure(feathers.hooks())
    .configure(feathers.authentication({
      storage: window.localStorage
    }));

feathersClient.service('users').create({
  email: 'test@example.com',
  password: 'testing'
});

然后您将能够像这样对用户进行身份验证:

feathersClient.authenticate({
  type: 'local',
  email: 'test@example.com',
  password: 'testing'
});