go beego

一、

引入

go get github.com/astaxie/beego
go get gitgub.com/beego/bee
go get -u gitxxx....  更新框架

编写

package main

import "github.com/astaxie/beego"

func main() {
    beego.Run()
}

编译或F5

go build -o hello hello.go
./hello

访问

http://localhost:8080

二、

 编码

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()
}

访问

原文地址:https://www.cnblogs.com/buchizaodian/p/10811105.html