Skip to content
A Go web app framework with views for constructing web pages, supports CGI & FCGI.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
apps
examples
ext
sm
.gitignore
.gitmodules
Makefile
README.md
app.go
app_test.go
cgi.go
err.go
fcgi.go
funs.sh
make.sh
setup.sh
viewmgr.go

README.md

web

A Go web app framework with views for constructing web pages, supports CGI & FCGI.

package main

import (
        "web"
        "fmt"
        "os"
)

var counter = 0

func hello(request *web.Request, response *web.Response) (err os.Error) {
        counter += 1
        response.Header.Set("Content-Type", "text/html")
        fmt.Fprintf(response.BodyWriter, "<b>test</b>: <small>num=%d</small><br/>\n", counter)
        return
}

func main() {
        m, err := web.NewFCGIModel()
        if err != nil {
                fmt.Printf("%v\n", err)
                return
        }

        app, err := web.NewApp(m)
        if err != nil {
                fmt.Printf("%v\n", err)
                return
        }

        if app == nil {
                fmt.Printf("no app\n")
                return
        }

        app.HandleDefault(web.FuncHandler(hello))
        app.Exec()
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.