美文网首页
Beego 2.0 正常启动项目 但是访问swagger提示路由

Beego 2.0 正常启动项目 但是访问swagger提示路由

作者: 梨花菜 | 来源:发表于2021-03-16 23:55 被阅读0次

    操作记录

    • 使用bee api在$GOPATH/src创建一个项目apiproj
    • $GOPATH/src/apiproj下面运行bee run,正常启动项目
    • 但是访问swagger提示路由错误


      image

    解决方案

    bee run改成bee run -gendoc=true -downdoc=true
    原因是首次启动需要下载和生成文档
    下面是加入生成文档和下载文档的参数后,服务正常启动,并且能正常访问swagger,搞定~

    image
    # rikasai @ huacainoMacBook-Pro in ~/go/src/apiproj [23:43:44] C:130
    $ bee run -gendoc=true -downdoc=true
    ______
    | ___ \
    | |_/ /  ___   ___
    | ___ \ / _ \ / _ \
    | |_/ /|  __/|  __/
    \____/  \___| \___| v2.0.2
    2021/03/16 23:43:45 INFO     ▶ 0001 Using 'apiproj' as 'appname'
    2021/03/16 23:43:45 INFO     ▶ 0002 Downloading 'https://github.com/beego/swagger/archive/v3.zip' to 'swagger.zip'...
    2021/03/16 23:43:55 SUCCESS  ▶ 0003 477861 bytes downloaded!
    2021/03/16 23:43:55 INFO     ▶ 0004 Unzipping 'swagger.zip'...
    2021/03/16 23:43:55 SUCCESS  ▶ 0005 Done! Deleting 'swagger.zip'...
    2021/03/16 23:43:55 INFO     ▶ 0006 Initializing watcher...
    2021/03/16 23:43:55 INFO     ▶ 0007 Generating the docs...
    2021/03/16 23:43:55 SUCCESS  ▶ 0008 Docs generated!
    2021/03/16 23:43:56 SUCCESS  ▶ 0009 Built Successfully!
    2021/03/16 23:43:56 INFO     ▶ 0010 Restarting 'apiproj'...
    2021/03/16 23:43:56 SUCCESS  ▶ 0011 './apiproj' is running...
    2021/03/16 23:43:57.327 [I] [parser.go:85]  /Users/rikasai/go/src/apiproj/controllers no changed
    
    2021/03/16 23:43:57.327 [I] [server.go:241]  http server Running on http://:8080
    
    2021/03/16 23:44:07.397 [D] [router.go:955]  |            ::1| 200 |    168.939µs|   match| GET      /swagger/
    

    相关文章

      网友评论

          本文标题:Beego 2.0 正常启动项目 但是访问swagger提示路由

          本文链接:https://www.haomeiwen.com/subject/cuajcltx.html