基于 Gin 的 Go (风格)轻量高效的前端组件化 web 框架,这是一项正在完善的工作
Ego 是一个用 Go 编写的全栈 Web 框架,轻量级和高效的前端组件解决方案
前端编译执行,不影响后端效率
安装:
go get -u gitee.com/veni0/ego
例子: https://gitee.com/veni0/ego/tree/master/examples/ego
路由:
package main import ( "gitee.com/veni0/ego" ) func main() { router := ego.Classic() ego.UseRenders() router.GlobHTML("views/html/*") parArr := [5]int{1, 2, 3, 4, 5} router.EgoRouter("/head/", "head/head.html", ego.Map{ "head": "Test to load the HTML template", "parArr": parArr, }) router.Run(":3100") } //package head head.html import ( "icons" icon "icons/icon.vgo" ) //
效果图:
另外写了一个Json预览和测试页面:
package main import ( "gitee.com/veni0/ego" ) const httpUrl string = "http://127.0.0.1:3000" func main() { router := ego.Classic() router.Static("/js", "./views/js") router.Static("/src", "./views/src") router.GlobHTML("views/html/*") strUrl := httpUrl + "/test/hlist" paramMap := ego.Map{ "lon": "10.1010101", "lat": "20.202020", "type": "1", } router.TestHtml(strUrl, paramMap) router.Run(":3100") }