增加入门文档和删除打开默认文档出错日志
Showing
2 changed files
with
35 additions
and
2 deletions
| ... | @@ -13,4 +13,37 @@ To install: | ... | @@ -13,4 +13,37 @@ To install: |
| 13 | 13 | ||
| 14 | go install github.com/astaxie/beego | 14 | go install github.com/astaxie/beego |
| 15 | 15 | ||
| 16 | go version: go1 release | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 16 | go version: go1 release | ||
| 17 | |||
| 18 | Quick Start | ||
| 19 | ============ | ||
| 20 | Here is the canonical "Hello, world" example app for beego: | ||
| 21 | |||
| 22 | package main | ||
| 23 | |||
| 24 | import ( | ||
| 25 | "github.com/astaxie/beego" | ||
| 26 | ) | ||
| 27 | |||
| 28 | type MainController struct { | ||
| 29 | beego.Controller | ||
| 30 | } | ||
| 31 | |||
| 32 | func (this *MainController) Get() { | ||
| 33 | this.Ct.WriteString("hello world") | ||
| 34 | } | ||
| 35 | |||
| 36 | func main() { | ||
| 37 | beego.BeeApp.RegisterController("/", &MainController{}) | ||
| 38 | beego.BeeApp.Run() | ||
| 39 | } | ||
| 40 | |||
| 41 | default port:8080 | ||
| 42 | |||
| 43 | http get http://localhost:8080 | ||
| 44 | HTTP/1.1 200 OK | ||
| 45 | Content-Type: text/plain; charset=utf-8 | ||
| 46 | Date: Sat, 15 Dec 2012 16:03:00 GMT | ||
| 47 | Transfer-Encoding: chunked | ||
| 48 | |||
| 49 | hello world | ... | ... |
| ... | @@ -28,7 +28,7 @@ func init() { | ... | @@ -28,7 +28,7 @@ func init() { |
| 28 | var err error | 28 | var err error |
| 29 | AppConfig, err = LoadConfig(path.Join(AppPath, "conf", "app.conf")) | 29 | AppConfig, err = LoadConfig(path.Join(AppPath, "conf", "app.conf")) |
| 30 | if err != nil { | 30 | if err != nil { |
| 31 | Trace("open Config err:", err) | 31 | //Trace("open Config err:", err) |
| 32 | HttpAddr = "" | 32 | HttpAddr = "" |
| 33 | HttpPort = 8080 | 33 | HttpPort = 8080 |
| 34 | AppName = "beego" | 34 | AppName = "beego" | ... | ... |
-
Please register or sign in to post a comment