Goweb开发框架Baa.zip
Baa 一个简单高效的Go web开发框架。主要有路由、中间件,依赖注入和HTTP上下文构成。Baa 不使用 ``反射``和``正则``,没有魔法的实现。快速上手安装:go get -u gopkg.in/baa.v1示例:package main import ( "gopkg.in/baa.v1" ) func main() { app := baa.New() app.Get("/", func(c *baa.Context) { c.String(200, "Hello World!") }) app.Run(":1323") }特性支持静态路由、参数路由、组路由(前缀路由/命名空间)和路由命名路由支持链式操作路由支持文件/目录服务支持中间件和链式操作支持依赖注入*支持JSON/JSONP/XML/HTML格式输出统一的HTTP错误处理统一的日志处理支持任意更换模板引擎(实现baa.Renderer接口即可)中间件[gzip](https://github.com/baa-middleware/gzip)[logger](https://github.com/baa-middleware/logger)[recovery](https://github.com/baa-middleware/recovery)[session](https://github.com/baa-middleware/session)组件(DI)[cache](https://github.com/go-baa/cache)[render](https://github.com/go-baa/render)性能测试和快速的Echo框架对比 [Echo](https://github.com/labstack/echo)> 注意:[Echo](https://github.com/labstack/echo) 在V2版本中使用了fasthttp,我们这里使用 [Echo V1](https://github.com/labstack/echo/releases/tag/v1.4) 测试。路由测试使用 [go-http-routing-benchmark] (https://github.com/safeie/go-http-routing-benchmark) 测试, 2016-02-27 更新.[GitHub API](http://developer.github.com/v3)> Baa的路由性能非常接近 Echo.BenchmarkBaa_GithubAll 30000 50984 ns/op 0 B/op 0 allocs/op BenchmarkBeego_GithubAll 3000 478556 ns/op 6496 B/op 203 allocs/op BenchmarkEcho_GithubAll 30000 47121 ns/op 0 B/op 0 allocs/op BenchmarkGin_GithubAll 30000 41004 ns/op 0 B/op 0 allocs/op BenchmarkGocraftWeb_GithubAll 3000 450709 ns/op 131656 B/op 1686 allocs/op BenchmarkGorillaMux_GithubAll 200 6591485 ns/op 154880 B/op 2469 allocs/op BenchmarkMacaron_GithubAll 2000 679559 ns/op 201140 B/op 1803 allocs/op BenchmarkMartini_GithubAll 300 5680389 ns/op 228216 B/op 2483 allocs/op BenchmarkRevel_GithubAll 1000 1413894 ns/op 337424 B/op 5512 allocs/opHTTP测试Baa:package main import ( "github.com/baa-middleware/logger" "github.com/baa-middleware/recovery" "
用户评论