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

vz / ego
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 5.36 KB
一键复制 编辑 原始数据 按行查看 历史
vz 提交于 2017-08-27 11:51 . Update README.md

Ego

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

Ego is a full-stack web framework written in Go, lightweight and efficient front-end component solutions, based on gin. The front-end is compiled, does not affect the back-end.

This is a work in progress.

简体中文

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

To create a new Ego web application

$ re new my-webapp

re run

To run the application we just created, you can navigate to the application folder and execute:

$ 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>

Renderings:

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 parameter, args (optional parameters): The default is "data".

  router.Run(":3100")
}

Renderings:

More instructions

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.

Go
1
https://gitee.com/veni0/ego.git
git@gitee.com:veni0/ego.git
veni0
ego
ego
master

搜索帮助