| layout | default |
|---|---|
| title | Home |
| nav_order | 1 |
| description | A Go web framework for humans, heavily inspired by Koa. |
| permalink | / |
{: .fs-9 }
A Go web framework for humans, heavily inspired by Koa. {: .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 }
Install with go get:
$ go get -u github.com/aisk/voxpackage main
import (
"fmt"
"time"
"github.com/aisk/vox"
)
func main() {
app := vox.New()
// custom middleware that adds an X-Response-Time 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.