layout | title | nav_order | description | permalink |
---|---|---|---|---|
default |
Home |
1 |
A golang web framework for humans, inspired by Koa heavily. |
/ |
{: .fs-9 }
A golang web framework for humans, inspired by Koa heavily. {: .fs-6 .fw-300 }
Get started now{: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } View it on GitHub{: .btn .fs-5 .mb-4 .mb-md-0 }
Using the go get
power:
$ 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
app.Get("/hello/{name}", func(ctx *vox.Context, req *vox.Request, res *vox.Response) {
res.Body = "Hello, " + req.Params["name"] + "!"
})
app.Run("localhost:3000")
}
Vox is © 2016-2020 by aisk.
Vox is distributed by a MIT license.