Phillip England
Minimal servers in Go
1go get github.com/Phillip-England/vii
go project./templates dir./static dirBasic Server:
1package main
2
3import (
4 "github.com/Phillip-England/vii"
5)
6
7func main() {
8 app := vii.NewApp()
9 app.Use(vii.MwLogger, vii.MwTimeout(10))
10 app.Static("./static")
11 app.Favicon()
12 err := app.Templates("./templates", nil)
13 if err != nil {
14 panic(err)
15 }
16 app.At("GET /", func(w http.ResponseWriter, r *http.Request) {
17 vii.ExecuteTemplate(w, r, "index.html", nil)
18 })
19 app.Serve("8080")
20}