Skip to main content Link Search Menu Expand Document (external link)

VOX: Go Web Framework for Humans

A golang web framework for humans, inspired by Koa heavily.

Get started now View it on GitHub


Getting started

Installation

Using the go get power:

$ go get -u github.com/aisk/vox

Basic Web Application

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")
}

About the project

Vox is © 2016-2020 by aisk.

License

Vox is distributed by a MIT license.


Copyright © 2016-2020 aisk. Distributed by an MIT license.