gdwrd / banjo

BANjO is a simple web framework written in Go (golang)

Home Page:https://nsheremet.pw/banjo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BANjO

Build Status Software License GoDoc Coverage Status Go Report Card

banjo it's a simple web framework for building simple web applications

Install

$ go get github.com/nsheremet/banjo

Example Usage

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
  })

License

banjo is primarily distributed under the terms of Mozilla Public License 2.0.

See LICENSE for details.

About

BANjO is a simple web framework written in Go (golang)

https://nsheremet.pw/banjo

License:Mozilla Public License 2.0


Languages

Language:Go 100.0%