Webgo Go 实现的 Web 框架开源项目

我要开发同款
匿名用户2018年07月09日
60阅读
开发技术GO语言
所属分类Google Go、Web框架、Web应用开发
授权协议Apache-2.0

作品详情

webgo,agolangwebframeworkforvectorsERPsystem

框架提供关于Http服务器端最精简逻辑实现,理论上可以兼容大部分其他框架中间件(需要小量修改)。

服务器目录树App│├─module 应用模块目录│  ├─web 模块目录│  │  ├─static 静态资源目录│  │  │   ├─uploads 上传根目录│  │  │   ├─lib 资源库文件目录(常用作前端框架库)│  │  │   └─src 资源文件│  │  │      ├─js 资源Js文件目录│  │  │      ├─img 资源图片文件目录│  │  │      └─css 资源Css文件│  │  ├─model 模型目录│  │  ├─template 视图文件目录│  │  ├─data 数据目录│  │  ├─model 模型目录│  │  └─controller.go 控制器│  ││  ├─base 模块目录│  ││  └─... 扩展的可装卸功能模块或插件│├─static 静态资源目录│  ├─uploads 上传根目录│  ├─lib 资源库文件目录(常用作前端框架库)│  └─src 资源文件│     ├─js 资源Js文件目录│     ├─img 资源图片文件目录│     └─css 资源Css文件├─template 视图文件目录├─deploy 部署文件目录│├─main.go 主文件└─main.ini 配置文件

helloworlddemo

package mainimport (  "fmt"  "github.com/VectorsOrigin/web")type (  ctrls struct {  })func (self ctrls) hello_world(hd *web.THandler) {  hd.RespondString("Hello Webgo World!")}func main() {  srv := web.NewServer("")  srv.Get("/hello", ctrls.hello_world)  srv.Get("/hello2", func(c *web.THandler) {    c.RespondString("Hello, World")    return  })  srv.Get("/hello3", func(c *web.THandler) {    c.RenderTemplate("hello_world.html", map[string]interface{}{"static": "youpath"})    fmt.Println("b", c.Route.FilePath)    return  })  srv.Listen(":8080")}
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论