使用 go + angular 开发系统门户
Table of Contents
golang和angular对于我来说都还是比较新的东西。这是我在github上的项目,目的是通过这个项目去演练一下使用这两种较新的技术来开发下一代 的门户系统。通过开发这个项目可以积累一些经验,将来可以使用到真正的项目中去。同时希望有志同道合的朋友加入进来一起开发。
本项目主要是使用了下面的技术:
- build-web-application-with-golang 这篇文章非常详细的介绍了go语言
- go web 框架
- malhar-dashboard-webapp (Angularjs dashboard)
安装
- 下载 go1.2 Windows (x86 32-bit) MSI installer : https://code.google.com/p/go/downloads/list
修改windows环境变量
export GOROOT=~/go export GOBIN=$GOROOT/bin export PATH=$PATH:$GOBIN export GOPATH=/ideas/go
SMTP
http://stackoverflow.com/questions/11623232/the-go-language-exec-command-method-execute-failed
http://www.ibm.com/developerworks/web/library/wa-aj-consume/
http://weblogs.java.net/blog/caroljmcdonald/archive/2008/07/a_dynamic_ajax.html
http://robfig.github.io/revel/
http://www.cnblogs.com/ztiandan/archive/2013/01/17/2864498.html
go easy portal
安装
- State "DONE" from "OKTODAY"
- State "OKTODAY" from "STARTED"
- State "OKTODAY" from "STARTED"
- State "OKTODAY" from "STARTED"
sudo yum install -y golang #wget -c https://go.googlecode.com/files/go1.2.1.linux-amd64.tar.gz
设置gopath
编辑 .bashrc 文件
export GOPATH=/home/will/mygo export PATH=$GOPATH/bin:$PATH
beego
go get github.com/beego/bee go get -v -u github.com/mattn/go-sqlite3 go get -v -u github.com/nsf/gocode
创建项目
- State "DONE" from "OKTODAY"
- State "OKTODAY" from "STARTED"
- State "OKTODAY" from "STARTED"
- State "OKTODAY" from "STARTED"
cd $GOPATH/src bee new go-easy-portal # https://help.github.com/articles/create-a-repo cd go-easy-portal git init git add conf git add controllers/ git add main.go git add routers/ git add tests/ git add views/ git status git commit -a -m "init version" git remote add origin https://github.com/standino/go-easy-portal git pull origin master git commit -a -m "init version" git push origin master git remote add -f jquery-ui-portlet https://github.com/standino/jquery-ui-portlet.git git subtree add --prefix=static/jquery-ui-portlet jquery-ui-portlet master --squash git remote add -f FCBKcomplete https://github.com/standino/FCBKcomplete.git git subtree add --prefix=static/FCBKcomplete FCBKcomplete master --squash git remote add -f bootstrap-datetimepicker https://github.com/standino/bootstrap-datetimepicker.git git subtree add --prefix=static/bootstrap-datetimepicker bootstrap-datetimepicker master --squash git remote add -f iCheck https://github.com/standino/iCheck.git git subtree add --prefix=static/iCheck iCheck master --squash git remote add -f bootstrap-calendar https://github.com/standino/bootstrap-calendar.git git subtree add --prefix=static/bootstrap-calendar bootstrap-calendar master --squash git remote add -f bootstrap-paginator https://github.com/standino/bootstrap-paginator.git git subtree add --prefix=static/bootstrap-paginator bootstrap-paginator master --squash git remote add -f bootstrap-select https://github.com/standino/bootstrap-select.git git subtree add --prefix=static/bootstrap-select bootstrap-select master --squash git remote add -f angular-ui-dashboard https://github.com/nickholub/angular-ui-dashboard git subtree add --prefix=static/angular-ui-dashboard angular-ui-dashboard master --squash git remote add -f angular-dashboard-app https://github.com/nickholub/angular-dashboard-app git subtree add --prefix=static/angular-dashboard-app angular-dashboard-app master --squash git remote add -f d3 https://github.com/standino/d3 git subtree add --prefix=static/d3 d3 master git remote add -f angular-d3-demo https://github.com/standino/angular-d3-demo.git git subtree add --prefix=static/angular-d3-demo angular-d3-demo master git remote add -f malhar-dashboard-webapp https://github.com/standino/malhar-dashboard-webapp.git git subtree add --prefix=static/malhar-dashboard-webapp malhar-dashboard-webapp master
sqlite db
orm.RegisterDataBase("db2", "sqlite3", "data.db")
加入angular js
- State "DONE" from "STARTED"
部署
linux
在 linux 下面部署,我们可以利用 nohup 命令,把应用部署在后端,如下所示:
nohup ./beepkg & 这样你的应用就跑在了 Linux 系统的守护进程