Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

⛳ The Golf web framework

License

NotificationsYou must be signed in to change notification settings

dinever/golf

Repository files navigation

GoDocLicenseBuild StatusBuild StatusCoverage 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 withextends andinclude 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 mainimport"github.com/dinever/golf"funcmainHandler(ctx*golf.Context) {ctx.Send("Hello World!")}funcpageHandler(ctx*golf.Context) {ctx.Send("Page: "+ctx.Param("page"))}funcmain() {app:=golf.New()app.Get("/",mainHandler)app.Get("/p/:page/",pageHandler)app.Run(":9000")}

The website will be available athttp://localhost:9000.

Benchmark

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

Golf benchmark

For more information, please seeBENCHMARKING.md

Docs

golf.readme.io/docs

License

MIT License


[8]ページ先頭

©2009-2025 Movatter.jp