【文件属性】:
文件名称:vox:受koa启发的简单轻便的Go Web框架
文件大小:21KB
文件格式:ZIP
更新时间:2021-02-03 14:44:33
go lightweight golang sinatra koa
VOX
受大力启发的人类Golang网络框架。
入门
安装
使用go get力量:
$ go get -u github.com/aisk/vox
基本网络应用
package main
import (
" fmt "
" time "
" github.com/aisk/vox "
)
func main () {
app := vox.New ()
// custom middleware that add a x-response-time to the response header
app.Use(func(ctx * vox.Context, req * vox.Request, res * vox.Response) {
start := time.Now ()
ctx.Next ()
duration := time.Now ().Sub(start)
res.Header.Set( " X-Response-Time " , fmt.Sprintf( " %s " , duration))
})
// router param
【文件预览】:
vox-master
----go.mod(36B)
----response_test.go(2KB)
----doc.go(1KB)
----response.go(3KB)
----index.md(1KB)
----.travis.yml(276B)
----LICENSE(1KB)
----logging.go(725B)
----_config.yml(215B)
----.github()
--------workflows()
----examples()
--------pprof()
--------integrate()
--------hello()
----handler.go(133B)
----README.md(2KB)
----context.go(435B)
----application_test.go(1KB)
----application.go(2KB)
----middlewares()
--------pprof()
----route.go(2KB)
----request_test.go(2KB)
----docs()
--------usage.md(4KB)
--------request.md(1KB)
--------run.md(1KB)
--------middleware.md(3KB)
----respond.go(675B)
----route_test.go(4KB)
----request.go(2KB)