banjo it's a simple web framework for building simple web applications
$ go get github.com/nsheremet/banjo
Simple Web App - main.go
package main
import "banjo"
func main() {
app := banjo.Create(banjo.DefaultConfig())
app.Get("/", func(ctx *banjo.Context) {
ctx.JSON(banjo.M{"foo":"bar"})
})
app.Run()
}
Example responses:
// ... Redirect To
app.Get("/admin", func(ctx *banjo.Context) {
ctx.RedirectTo("/")
})
// ... HTML
app.Get("/foo", func(ctx *banjo.Context) {
ctx.HTML("<h1>Hello from BONjO!</h1>")
})
// ... Return Params as JSON
app.Post("/bar", func(ctx *banjo.Context) {
ctx.JSON(banjo.M{
"params": ctx.Request.Params
})
ctx.Response.Status = 201
})
banjo
is primarily distributed under the terms of Mozilla Public License 2.0.
See LICENSE for details.