在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:aisk/vox开源软件地址:https://github.com/aisk/vox开源编程语言:Go 100.0%开源软件介绍:VOXA golang web framework for humans, inspired by Koa heavily. Getting startedInstallationUsing the $ go get -u github.com/aisk/vox Basic Web Applicationpackage 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
app.Get("/hello/{name}", func(ctx *vox.Context, req *vox.Request, res *vox.Response) {
res.Body = "Hello, " + req.Params["name"] + "!"
})
app.Run("localhost:3000")
} More DocsNeed Support?If you need help for using vox, or have other questions, welcome to our gitter chat room. About the ProjectVox is © 2016-2020 by aisk. LicenseVox is distributed by a MIT license. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论