这个项目把apache thrift和revel集成在了一起。
#特性
- 增加了"linend thrift"命令,可以直接生成go代码(必须先安装好thrift)
- 访问web可以热部署thrift RPC服务(访问RPC不能实现文件改动热部署)
#教程
- 查阅revel教程
- 查询thrift教程
#快速上手
go get github.com/linewin/linend
go get github.com/linewin/modules
go get github.com/linewin/cmd
##使用
linend new xxx.com/yyy/zzz
这将会在$GOPATH/src/xxx.com/yyy/zzz目录下生成项目
###运行项目
linend run xxx.com/yyy/zzz
访问http://localhost:9000可以查看网站,这个revel中的项目是一样。
生成的项目本身带有一个thrift计算器的示例。从这里下载你所用语言的客户端代码,运行它,可以看到类似这样的输出结果:
ping() 1+1=2 1+5=6 Whoa! We can divide by zero? 15-10=5 Log: 5
###Folder structure/目录结果
- 除了thrift目录,其它目录和revel一样
- "thrift"目录下有三个目录: gen, handlers, idl
- gen目录用于保存自动生成的代码,不要做任何修改
- handlers是主要工作的地方,添加RPC的实现逻辑
- thrift idl文件放在"idl"目录里,运行"linend run" 或 "linend thrift"命名时会自动解析idl文件 ,并把生成的文件放在前面提到的"gen"目录里
##DEV steps/开发步骤
- 把idl文件放在thrift/idl目录
- 执行"linend thrift xxx.com/yyy/zzz"来生成idl对应的go代码
- 在"thrift/handlers"中添加业务实现
The project is folked from revel.
We integrate apache thrift into it.
#Feature
- Add "revel thrift" cmd to auto parse idl file(thrift must be installed.)
- Visit http server to hot deploy thrift RPC service
#Guide
- Read revel docs
- Read thrift docs
#Quick Start
go get github.com/linewin/linend
go get github.com/linewin/modules
go get github.com/linewin/cmd
##Use
linend new xxx.com/yyy/zzz
The Project will be generated at $GOPATH/src/xxx.com/yyy/zzz
###Run project
linend thrift xxx.com/yyy/zzz linend run xxx.com/yyy/zzz
Visit http://localhost:9000 for web view, same as in revel.
The project was born with a thrift Calculator demo. Get Calculator client code in your language from here, Run it, you are supposed to see some output like this:
ping() 1+1=2 1+5=6 Whoa! We can divide by zero? 15-10=5 Log: 5
###Folder structure
- Same with revel except "thrift" folder
- Three folders in "thrift" : gen, handlers, idl
- Code in "gen" is auto generated by revel cmd, DO NOT edit files here, or you will lost all you done.
- Put you RPC handler in "handlers" folder
- Put thrift idl file in "idl" folder, when "linend run" or "linend thrift" executed, idl will be auto parsed and result code will be at "gen" folder.
##DEV steps
- put idl file in thrift/idl
- execute "linend thrift xxx.com/yyy/zzz"
- Add handler in "thrift/handlers" folder
A high productivity, full-stack web framework for the Go language.
Current Version: 0.12.0 (Mar 25, 2015)
As of Revel 0.11.0, Go 1.3+ is required.
Manual, Samples, Godocs, etc Revel's Roadmap Articles Featuring Revel
- Google Groups via revel-framework@googlegroups.com
- GitHub Issues
- StackOverflow Questions
- IRC via #revel on Freenode
View the v0.12.0 release notes for all of the relevant changes.
We are working on increasing the speed and quality of our releases. Your feedback has never been so valuable, please share your thoughts with us and help shape Revel!