Skip to content

upgrade app start interface #70

@fishbar

Description

@fishbar

通过重写 run.js中的 net.Server.prototype.listen(), 可以无感知的替换监听端口为domain-sock,
再通过process.honeycomb提供接口启动,看起来可以做到比现在的app挂载方式更优雅

file: run.js

net.Server.prototype.listen = () => {
  
};


process.honeycomb = {
  targetSock,
  config,
  ready: function (config) {
    
  }
};

app的编写就简化为:

file: app.js

// app 都有自己监听成功的事件,在成功的callback里调用ready
app.listen(()= >{
  process.honeycomb.ready({
    serverName: ''
    router: '',
    ....
  });
});

// app获取honeycomb的配置信息
process.honeycomb.config

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions