首页 > 其他 > 详细

Golang之hello,beego

时间:2018-02-03 16:45:10      阅读:248      评论:0      收藏:0      [点我收藏+]

学习谢大神的beego记录

过程:

技术分享图片

目录结构:

技术分享图片

编译命令:

go build -o myBeego.exe go_dev/day13/beego_example/main
执行myBeego.exe即可启动

效果:

技术分享图片

简易代码如下:

main/main.go

package main

import (
    "github.com/astaxie/beego"
    _ "go_dev/day13/beego_example/router"
)
func main(){
    beego.Run()
}

router/router.go

package router

import (
    "github.com/astaxie/beego"
    "go_dev/day13/beego_example/controller/IndexController"
)

func init(){
    //index交给 这个方法处理
    //beego默认需要模板文件
    beego.Router("/index",&IndexController.IndexController{},"*:Index")//"get:"

}

views/index/index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
hello beego
</body>
</html>

 

Golang之hello,beego

原文:https://www.cnblogs.com/pyyu/p/8409847.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!