We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我在app hook文件里给app注册了一个对象,想要在rpc服务实现的方法里面获取这个对象和ctx,从而查询数据库或者做些其他的操作。看官方的案例,实现的方法只能取到的res。那怎么在方法里面获取ctx,app 呢?
app.ts
class AppBootHook { app: any pool: any constructor(app: any) { this.app = app; } async didLoad() { // 所有的配置已经加载完毕 // 可以用来加载应用自定义的文件,启动自定义的服务 this.pool = initPuppeteerPool(); } async beforeClose() { // 在服务重启或者关闭时清除池子 if (this.pool.drain) { await this.pool.drain().then(() => this.pool.clear()); } } }
app/rpc/rpc.ts
exports.hello = async req => { **// 怎么获取app里的pool ?????** app.pool.do...... }
The text was updated successfully, but these errors were encountered:
不知道是不是这个链接地址是答案。自问自答 #3447
Sorry, something went wrong.
@naxiaoguang 是的
@gxcsoccer 可以 close 了?
gxcsoccer
No branches or pull requests
What happens?
我在app hook文件里给app注册了一个对象,想要在rpc服务实现的方法里面获取这个对象和ctx,从而查询数据库或者做些其他的操作。看官方的案例,实现的方法只能取到的res。那怎么在方法里面获取ctx,app 呢?
app.ts
app/rpc/rpc.ts
The text was updated successfully, but these errors were encountered: