https://github.com/gdwrd/banjo
BANjO is a simple web framework written in Go (golang)
https://github.com/gdwrd/banjo
Last synced: 10 days ago
JSON representation
BANjO is a simple web framework written in Go (golang)
- Host: GitHub
- URL: https://github.com/gdwrd/banjo
- Owner: gdwrd
- License: mpl-2.0
- Created: 2017-12-09T13:35:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-31T16:42:14.000Z (about 8 years ago)
- Last Synced: 2026-01-13T19:57:37.460Z (2 months ago)
- Language: Go
- Homepage: https://nsheremet.pw/banjo
- Size: 22.5 KB
- Stars: 24
- Watchers: 1
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-go-extra - banjo - 12-09T13:35:31Z|2018-01-31T16:42:14Z| (Web Frameworks / Fail injection)
README
# BANjO
[](https://travis-ci.org/nsheremet/banjo)
[](https://github.com/nsheremet/banjo/blob/master/LICENSE.md)
[](https://godoc.org/github.com/nsheremet/banjo)
[](http://codecov.io/github/nsheremet/banjo?branch=master)
[](https://goreportcard.com/report/github.com/nsheremet/banjo)
**banjo** it's a simple web framework for building simple web applications
## Install
```bash
$ go get github.com/nsheremet/banjo
```
## Example Usage
Simple Web App - `main.go`
```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:
```go
// ... Redirect To
app.Get("/admin", func(ctx *banjo.Context) {
ctx.RedirectTo("/")
})
// ... HTML
app.Get("/foo", func(ctx *banjo.Context) {
ctx.HTML("
Hello from BONjO!
")
})
// ... Return Params as JSON
app.Post("/bar", func(ctx *banjo.Context) {
ctx.JSON(banjo.M{
"params": ctx.Request.Params
})
ctx.Response.Status = 201
})
```
## License
`banjo` is primarily distributed under the terms of Mozilla Public License 2.0.
See LICENSE for details.