Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
d6cd1322
Commit
d6cd1322
authored
Apr 11, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go on write docs
parent
f4a64502
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
README.md
docs/en/README.md
+0
-0
Quickstart.md
docs/zh/Quickstart.md
+63
-0
No files found.
docs/en/README.md
0 → 100644
View file @
d6cd1322
This diff is collapsed.
Click to expand it.
docs/zh/Quickstart.md
View file @
d6cd1322
...
...
@@ -2,6 +2,69 @@
你对beego一无所知?没关系,这篇文档会很好的详细介绍beego的各个方面,看这个文档之前首先确认你已经安装了beego,如果你没有安装的话,请看这篇
[
安装指南
](
Install.md
)
## 最小应用
一个最小最简单的应用如下代码所示:
package main
import (
"github.com/astaxie/beego"
)
type MainController struct {
beego.Controller
}
func (this *MainController) Get() {
this.Ctx.WriteString("hello world")
}
func main() {
beego.Router("/", &MainController{})
beego.Run()
}
把上面的代码保存为hello.go,然后通过命令行进行编译并执行:
$ go build main.go
$ ./hello
这个时候你可以打开你的浏览器,通过这个地址浏览
[
http://127.0.0.1:8080
](
http://127.0.0.1:8080
)
返回“hello world”
那么上面的代码到底做了些什么呢?
1、首先我们引入了包
`github.com/astaxie/beego`
,beego包中会初始化一个BeeAPP的应用,
2、定义了Controller
3、定义了RESTFul方法
4、定义了main函数
5、Route注册路由
6、Run应用
## 新建项目
通过如下命令创建beego项目,首先进入gopath目录
bee create hello
这样就建立了一个项目hello,目录结构如下所示
.
├── conf
│ └── app.conf
├── controllers
│ └── default.go
├── main.go
├── models
├── static
│ ├── css
│ ├── img
│ └── js
└── views
└── index.tpl
## 开发模式
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment