golf

:golf: The Golf web framework

Github stars Tracking Chart

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

Main metrics

Overview
Name With Ownerdinever/golf
Primary LanguageGo
Program languageGo (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2015-11-18 15:10:14
Pushed At2021-08-27 22:20:34
Last Commit At2017-02-24 11:57:24
Release Count4
Last Release Namev0.3.0 (Posted on )
First Release Namev0.1.0 (Posted on )
用户参与
Stargazers Count269
Watchers Count17
Fork Count29
Commits Count194
Has Issues Enabled
Issues Count19
Issue Open Count6
Pull Requests Count12
Pull Requests Open Count0
Pull Requests Close Count1
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private