Go 实现的 Web 框架 Webgo

码农软件 · 软件分类 · Web框架 · 2019-03-24 12:41:55

软件介绍

webgo,a golang web framework for vectors ERP system

框架提供关于 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 配置文件

hello world demo

package main

import (
	"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")
}

本文地址:https://www.codercto.com/soft/d/2046.html

Dive Into Python 3

Dive Into Python 3

Mark Pilgrim / Apress / 2009-11-6 / USD 44.99

Mark Pilgrim's Dive Into Python 3 is a hands-on guide to Python 3 (the latest version of the Python language) and its differences from Python 2. As in the original book, Dive Into Python, each chapter......一起来看看 《Dive Into Python 3》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具