Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dinever/Golf
:golf: The Golf web framework
https://github.com/dinever/Golf
framework go golf middleware router server web webframework
Last synced: 17 days ago
JSON representation
:golf: The Golf web framework
- Host: GitHub
- URL: https://github.com/dinever/Golf
- Owner: dinever
- License: mit
- Created: 2015-11-18T15:10:14.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-08-27T22:20:34.000Z (about 3 years ago)
- Last Synced: 2024-09-30T06:55:15.785Z (about 1 month ago)
- Topics: framework, go, golf, middleware, router, server, web, webframework
- Language: Go
- Homepage: https://golf.readme.io/
- Size: 191 KB
- Stars: 269
- Watchers: 17
- Forks: 30
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![GoDoc](http://img.shields.io/badge/golf-documentation-blue.svg?style=flat-square)](http://golf.readme.io/docs)
[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/dinever/golf/master/LICENSE)
[![Build Status](http://img.shields.io/travis/dinever/golf.svg?style=flat-square)](https://travis-ci.org/dinever/golf)
[![Build Status](https://goreportcard.com/badge/github.com/dinever/golf?style=flat-square)](https://travis-ci.org/dinever/golf)
[![Coverage Status](http://img.shields.io/coveralls/dinever/golf.svg?style=flat-square)](https://coveralls.io/r/dinever/golf?branch=master)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](https://golf.readme.io/)
## Installation
go get github.com/dinever/golf
## Features
1. No allocation during routing and parameter retrieve.
1. Dead simple template inheritance with `extends` and `include` helper comes out of box.**layout.html**
```html
Hello World
{{ template "body" }}
{{ include "sidebar.html" }}
```
**index.html**```jinja2
{{ extends "layout.html" }}
{{ define "body"}}
Main content
{{ end }}
```
**sidebar.html**
```jinja2
Sidebar content
```
1. Built-in XSRF and Session support.
1. Powerful middleware chain.
1. Configuration from JSON file.## Hello World
```go
package mainimport "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](https://cloud.githubusercontent.com/assets/1311594/14748305/fcbdc216-0886-11e6-90a4-231e78acfb60.png)
For more information, please see [BENCHMARKING.md](BENCHMARKING.md)
## Docs
[golf.readme.io/docs](https://golf.readme.io/docs)
## License
[MIT License](/LICENSE)