当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
17 Star 35 Fork 0

vz / ego
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Ego

Build Status codecov CircleCI Status Go Report Card GoDoc Release Join the chat at https://gitter.im/go-ego/ego

Ego 是一个基于 Gin 用 Go 编写的全栈 Web 框架,轻量级和高效的前端组件解决方案. 前端编译执行,不影响后端效率.

这是一项正在完善的工作.

Contents

Docs

Requirements:

Go Version ≥1.7

Installation:

go get github.com/go-ego/ego

Update:

go get -u github.com/go-ego/ego  

Build-tools

go get -u github.com/go-ego/re 

re new

创建一个新的 Ego web 项目

$ re new my-webapp

re run

运行我们创建的 web 项目, 你可以导航到应用程序文件夹并执行:

$ cd my-webapp && re run

Examples:

Router

package main

import (
	"github.com/go-ego/ego"
)

func main() {

	router := ego.Classic()
	ego.UseRenders()

	router.GlobHTML("views/html/*")

	parArr := [5]int{1, 2, 3, 4, 5}
	router.Ego("/head/", "head/head.html", ego.Map{
		"head":   "Test to load the HTML template",
		"parArr": parArr,
	})

	router.Run(":3100")
}

icon.vgo

// pkg icon

<div class="icon">
	<i class="iconfont {vclass}" {node}></i>
	<p>{prpo}</p>
</div>

<style>

.header-left{
	float:left;
}

.header-right{
	float:right;
}

.iconfont {
  position: relative;
  font-size:24px
}
</style>

head.vgo

import (
	"icons"
	icon "icons/icon.vgo"
	)

<div class="head">
	<div>ego:{{.head}}</div>

	<icon>
		vclass={icon-share-to}
		node={ id="slot1"}
		prpo={node---1}
	</icon>

	<div>
		{{range .parArr}}
	        <p>arr::: {{.}}</p>
		{{end}}
	</div>

</div>

渲染效果:

TestRestful


package main

import (
	"github.com/go-ego/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) // http url, http 参数, args (可选参数): 默认为 "data"

  router.Run(":3100")
}

效果图:

更多说明

Plans

  • Compression and merge css/js
  • CSS Preprocessing
  • Try supports MVVM and vdom
  • Update web framework

Donate

Contributing

License

Ego is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.

See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.

MIT License Copyright (c) 2016 go-ego Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Ego 是一个用 Go 编写的全栈 Web 框架,轻量级和高效的前端组件解决方案 展开 收起
Go
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/veni0/ego.git
git@gitee.com:veni0/ego.git
veni0
ego
ego
master

搜索帮助

14c37bed 8189591 565d56ea 8189591