Her Framework 介绍<a href="https://github.com/go-web-framework/handy#%E5%AE%89%E8%A3%85"></a>安装<a href="https://github.com/go-web-framework/handy#%E4%BD%BF%E7%94%A8"></a>使用 介绍
介绍
用 Go 实现的一个简单的 MVC 模式框架,目前支持:
-
路由/RESTFUL(route)
-
控制器(handler)
-
视图(templates)
-
表单(form)
-
静态文件(static)
安装
请确保Go环境已经安装,如未安装请参考 Go 环境安装,请安装最新版。
go get github.com/go-code/her
使用
package main import ( "github.com/go-code/her" ) func main() { app := her.NewApplication() app.Route.Handle("/", func() string { return "hello world!" }) app.Route.Handle("/hello/{val}", func(val string) string { return "hello " + val }) app.Route.Handle("/hi/{val}", func(ctx *her.Context, val string) { ctx.WriteString("hi " + val) }) app.Start() }
启动程序访问8080端口,默认端口为8080
[](https://github.com/go-web-
framework/handy#%E5%8F%82%E8%80%83%E4%BD%BF%E7%94%A8%E9%A1%B9%E7%9B%AE)参考、使用项目
[](https://github.com/go-web-
framework/handy#%E5%BC%80%E5%8F%91%E6%88%90%E5%91%98)开发成员
John, Monkey
Her Framework 介绍<a href="https://github.com/go-web-framework/handy#%E5%AE%89%E8%A3%85"></a>安装<a href="https://github.com/go-web-framework/handy#%E4%BD%BF%E7%94%A8"></a>使用 官网
https://github.com/go-code/her
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。