如何在不启动服务器的情况下生成 feathersjs primus 客户端

How to generate feathersjs primus client without starting the server

我使用下面的代码生成 featherjs-primus 客户端 js 文件。但是 primus function 直到我调用 app.listen() 才被调用。有没有办法让我在不启动服务器的情况下生成这个文件?

app
  .configure(primus({
    transformer: 'websockets',
    timeout: false
  }, (primus) => {
    const lib = primus.library();
    primus.save(path.join(__dirname, '../public/dist/primus.test.js'));
  }))

您可以拨打app.setup instead of app.listen to run that callback. The websocket providers will however need an HTTP server passed to app.setup. More information can be found in the middleware chapter.