semi-xi / blog

blog
4 stars 1 forks source link

egg #27

Open semi-xi opened 4 years ago

semi-xi commented 4 years ago

Router

处理用户的输入信息

中间件

拦截用户的请求,并在前后做一些事情

Controller

负责解析用户的输入,处理返回后的结果

// 固定挂载 
this.ctx
this.app
this.service
this.config
this.logger

参数

this.ctx.query
this.ctx.queries
this.ctx.params
不要搞混this.ctx.request.body 以及this.ctx.body 后面指的是this.cex.response.body

Service

处理业务,并把业务结果封装返回给Controller 一般用于第三发服务的调用

// 固定挂载 
this.ctx
this.app
this.service
this.config
this.logger

schedule