Skip to content

Commit

Permalink
Version 0.3.11
Browse files Browse the repository at this point in the history
* 新增Group支持,可通过HttpServer.Group()或者NewGroup()创建,目前Group支持HEAD\GET\POST\PUT\OPTIONS\PATCH\DELETE路由方法
* Middleware支持三个级别Use:DotWeb.Use\Group.Use\RouterNode.Use
* 优化Router实现,移除router目录,整合xRouter和router.Router
* 废弃:移除RouterNode级别的Feature支持,原RouterNode.Features.SetEnabledCROS 可通过自实现Middleware实现
* 更新 example/middleware 目录
```go
func InitRoute(server *dotweb.HttpServer) {
	server.Router().GET("/", Index)
	server.Router().GET("/use", Index).Use(NewAccessFmtLog("Router-use"))

	g := server.Group("/group").Use(NewAccessFmtLog("group"))
	g.GET("/", Index)
	g.GET("/use", Index).Use(NewAccessFmtLog("group-use"))
}
```
* 2017-05-6 00:30
  • Loading branch information
[email protected] committed May 5, 2017
1 parent 242fc7b commit 1590754
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,19 @@ func(ctx *dotweb.HttpContext) TestBind{

```

## 中间件(拦截器)
#### RegisterModule
## 中间件
#### RegisterModule - 拦截器
* 支持OnBeginRequest、OnEndRequest两类中间件
* 通过实现HttpModule.OnBeginRequest、HttpModule.OnEndRequest接口实现自定义中间件
* 通过设置HttpContext.End()提前终止请求

#### Middleware - 中间件
* 支持粒度:App、Group、RouterNode
* DotWeb.Use(m ...Middleware)
* Group.Use(m ...Middleware)
* RouterNode.Use(m ...Middleware)
* 启用顺序:App -> Group -> RouterNode

## 异常
#### 500错误
* 默认设置: 当发生未处理异常时,会根据DebugMode向页面输出默认错误信息或者具体异常信息,并返回 500 错误头
Expand Down

0 comments on commit 1590754

Please sign in to comment.