Golf 一种快速、简单、轻量级的Go Web框架

网友投稿 616 2022-10-28

Golf 一种快速、简单、轻量级的Go Web框架

Golf  一种快速、简单、轻量级的Go Web框架

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

No allocation during routing and parameter retrieve. Dead simple template inheritance with extends and include helper comes out of box. layout.html

Hello World

{{ template "body" }}{{ include "sidebar.html" }} index.html{{ extends "layout.html" }}{{ define "body"}}

Main content

{{ end }} sidebar.html

Sidebar content

Built-in XSRF and Session support. Powerful middleware chain. Configuration from JSON file.

Hello World

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.

For more information, please see BENCHMARKING.md

Docs

golf.readme.io/docs

License

MIT License

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:软考总结
下一篇:打印,excel、pdf导出及导入
相关文章

 发表评论

暂时没有评论,来抢沙发吧~