• 初次使用beego框架


    安装beego框架以及bee工具

    go get -u github.com/astaxie/beego
    go get github.com/beego/bee
    

      

    创建一个新项目

    bee new webapp 
    

      webapp是项目文件夹的名称,可随意指定,会在GOPATH的src目录下创建一个webapp目录,包含一些bee工具生成的文件目录:

    → ~/go/src $ ls webapp/
    conf		main.go		routers		tests
    controllers	models		static		views
    

      

    运行项目

      进入到上面创建的webapp项目中,使用bee工具:bee run

    → ~/go/src/webapp $ bee run
    ______
    | ___ 
    | |_/ /  ___   ___
    | ___  / _  / _ 
    | |_/ /|  __/|  __/
    \____/  \___| \___| v1.9.1
    2018/07/14 14:01:26 INFO     ▶ 0001 Using 'webapp' as 'appname'
    2018/07/14 14:01:26 INFO     ▶ 0002 Initializing watcher...
    2018/07/14 14:01:34 SUCCESS  ▶ 0003 Built Successfully!
    2018/07/14 14:01:34 INFO     ▶ 0004 Restarting 'webapp'...
    2018/07/14 14:01:34 SUCCESS  ▶ 0005 './webapp' is running...
    2018/07/14 14:01:34.398 [I] [asm_amd64.s:2337] http server Running on http://:8080
    

      注意上面输出的最后一行,http server监听本地的8080端口,所以可以使用浏览器访问localhost:8080即可看到下面的内容:

      

      

      

  • 相关阅读:
    Pick-up sticks
    The Doors
    Intersecting Lines
    Segments
    TOYS
    Palindrome
    Distinct Substrings
    Milk Patterns
    Musical Theme
    JavaScript基于时间的动画算法
  • 原文地址:https://www.cnblogs.com/-beyond/p/9309487.html
Copyright © 2020-2023  润新知