Go 的两个web 框架推荐
martini 轻量,推荐
http://martini.codegangsta.io/
https://github.com/go-martini/martini
package main
import "github.com/go-martini/martini"
func main() {
m := martini.Classic()
m.Get("/", func() string {
return "Hello world!"
})
m.Run()
}
Beego Framework 国产,较重
http://beego.me/
https://github.com/astaxie/beego/
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()
}
0
这个更快 goji https://github.com/zenazn/goji