https://github.com/nsheremet/banjo
BANjO is a simple web framework written in Go (golang)
https://github.com/nsheremet/banjo
Last synced: 10 days ago
JSON representation
BANjO is a simple web framework written in Go (golang)
- Host: GitHub
- URL: https://github.com/nsheremet/banjo
- Owner: gdwrd
- License: mpl-2.0
- Created: 2017-12-09T13:35:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-31T16:42:14.000Z (over 7 years ago)
- Last Synced: 2025-05-07T20:04:37.307Z (17 days ago)
- Language: Go
- Homepage: https://nsheremet.pw/banjo
- Size: 22.5 KB
- Stars: 24
- Watchers: 2
- 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 - banjo - BANjO is a simple web framework written in Go (golang) - ★ 3 (Web Frameworks)
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 mainimport "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.