Skip to content

dinever/golf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Feb 24, 2017
11abebb · Feb 24, 2017
Apr 25, 2016
Feb 24, 2017
Apr 22, 2016
Mar 1, 2016
Apr 24, 2016
Apr 24, 2016
Apr 22, 2016
Apr 22, 2016
Feb 24, 2017
Feb 24, 2017
Apr 24, 2016
Apr 13, 2016
Apr 22, 2016
Apr 24, 2016
Feb 24, 2017
Apr 27, 2016
Feb 24, 2017
Apr 22, 2016
Apr 24, 2016
Apr 21, 2016
Apr 24, 2016
Apr 24, 2016
Apr 21, 2016
Jun 3, 2016
Apr 22, 2016

Repository files navigation

GoDoc License Build Status Build Status Coverage Status

A fast, simple and lightweight micro-web framework for Go, comes with powerful features and has no dependencies other than the Go Standard Library.

Homepage: golf.readme.io

Installation

go get github.com/dinever/golf

Features

  1. No allocation during routing and parameter retrieve.

  2. Dead simple template inheritance with extends and include helper comes out of box.

    layout.html

    <h1>Hello World</h1>
    {{ template "body" }}
    {{ include "sidebar.html" }}

    index.html

    {{ extends "layout.html" }}
    
    {{ define "body"}}
    <p>Main content</p>
    {{ end }}

    sidebar.html

    <p>Sidebar content</p>
  3. Built-in XSRF and Session support.

  4. Powerful middleware chain.

  5. Configuration from JSON file.

Hello World

package main

import "github.com/dinever/golf"

func mainHandler(ctx *golf.Context) {
  ctx.Send("Hello World!")
}

func pageHandler(ctx *golf.Context) {
  ctx.Send("Page: " + ctx.Param("page"))
}

func main() {
  app := golf.New()
  app.Get("/", mainHandler)
  app.Get("/p/:page/", pageHandler)
  app.Run(":9000")
}

The website will be available at http://localhost:9000.

Benchmark

The following chart shows the benchmark performance of Golf compared with others.

Golf benchmark

For more information, please see BENCHMARKING.md

Docs

golf.readme.io/docs

License

MIT License