Here is the canonical "Hello, world" example app for beego:
```go
packagemain
packagemain
import(
import(
"github.com/astaxie/beego"
)
)
typeMainControllerstruct{
typeMainControllerstruct{
beego.Controller
}
}
func(this*MainController)Get(){
func(this*MainController)Get(){
this.Ctx.WriteString("hello world")
}
}
funcmain(){
funcmain(){
beego.RegisterController("/",&MainController{})
//beego.HttpPort = 8080 // default
beego.Run()
}
}
```
http get http://localhost:8080/
...
...
@@ -54,16 +54,16 @@ Some associated tools for beego reside in:[bee](https://github.com/astaxie/bee)
============
In beego, a route is a struct paired with a URL-matching pattern. The struct has many method with the same name of http method to serve the http response. Each route is associated with a block.