A golang web framework for humans, inspired by Koa heavily.
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")
}
If you need help for using vox, or have other questions, welcome to our gitter chat room.
Vox is © 2016-2020 by aisk.
Vox is distributed by a MIT license.