Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gdwrd/banjo
BANjO is a simple web framework written in Go (golang)
https://github.com/gdwrd/banjo
Last synced: about 1 month 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 (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-31T16:42:14.000Z (almost 7 years ago)
- Last Synced: 2024-03-21T07:15:57.745Z (9 months ago)
- Language: Go
- Homepage: https://nsheremet.pw/banjo
- Size: 22.5 KB
- Stars: 22
- Watchers: 2
- Forks: 7
- 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
[![Build Status](https://travis-ci.org/nsheremet/banjo.svg?branch=master)](https://travis-ci.org/nsheremet/banjo)
[![Software License](https://img.shields.io/badge/License-MPL--2.0-green.svg)](https://github.com/nsheremet/banjo/blob/master/LICENSE.md)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/nsheremet/banjo)
[![Coverage Status](http://codecov.io/github/nsheremet/banjo/coverage.svg?branch=master)](http://codecov.io/github/nsheremet/banjo?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/nsheremet/banjo)](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.