代码拉取完成,页面将自动刷新
一个简单高效的Go web开发框架。主要有路由、中间件,依赖注入和HTTP上下文构成。
Baa 不使用 反射
和正则
,没有魔法的实现。
安装:
go get -u github.com/go-baa/baa
示例:
// baa.go
package main
import (
"github.com/go-baa/baa"
)
func main() {
app := baa.New()
app.Get("/", func(c *baa.Context) {
c.String(200, "Hello, 世界")
})
app.Run(":1323")
}
编译:
Baa use encoding/json as default json package but you can change to jsoniter by build from other tags
go build -tags=jsoniter .
运行:
go run baa.go
浏览:
http://127.0.0.1:1323/
https://github.com/go-baa/example
使用 [go-http-routing-benchmark] (https://github.com/safeie/go-http-routing-benchmark) 测试, 2016-02-27 更新.
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/op
Baa:
package main
import (
"github.com/go-baa/baa"
)
func main() {
app := baa.New()
app.Get("/", func(c *baa.Context) {
c.String(200, "Hello, 世界")
})
app.Run(":1323")
}
$ wrk -t 10 -c 100 -d 30 http://127.0.0.1:1323/
Running 30s test @ http://127.0.0.1:1323/
10 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.64ms 299.23us 8.25ms 66.84%
Req/Sec 6.11k 579.08 8.72k 68.74%
1827365 requests in 30.10s, 228.30MB read
Requests/sec: 60704.90
Transfer/sec: 7.58MB
目前使用在 健康一线 的私有项目中。
This project is under the MIT License (MIT) See the LICENSE file for the full license text.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型