You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
565 B

  1. package znet
  2. import "github.com/aceld/zinx/ziface"
  3. //实现router时,先嵌入这个基类,然后根据需要对这个基类的方法进行重写
  4. type BaseRouter struct{}
  5. //这里之所以BaseRouter的方法都为空,
  6. // 是因为有的Router不希望有PreHandle或PostHandle
  7. // 所以Router全部继承BaseRouter的好处是,不需要实现PreHandle和PostHandle也可以实例化
  8. func (br *BaseRouter) PreHandle(req ziface.IRequest) {}
  9. func (br *BaseRouter) Handle(req ziface.IRequest) {}
  10. func (br *BaseRouter) PostHandle(req ziface.IRequest) {}