8000 GitHub - womine/ego: 简单的Go微服务框架 · GitHub
[go: up one dir, main page]

Skip to content
wominePublic
forked from gotomicro/ego

About

简单的Go微服务框架

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

EGO

Go Go Report Card codecov goproxy.cn Release License: MIT

帮助文档

https://ego.gocn.vip

Quick Start

HelloWorld

import (
   "github.com/gin-gonic/gin"
   "github.com/gotomicro/ego"
   "github.com/gotomicro/ego/core/elog"
   "github.com/gotomicro/ego/server"
   "github.com/gotomicro/ego/server/egin"
)
//  export EGO_DEBUG=true && go run main.go --config=config.toml
func main() {
   if err := ego.New().Serve(func() *egin.Component {
      server := egin.Load("server.http").Build()
      server.GET("/hello", func(ctx *gin.Context) {
         ctx.JSON(200, "Hello EGO")
         return
      })
      return server
   }()).Run(); err != nil {
      elog.Panic("startup", elog.FieldErr(err))
   }
}

使用命令行运行

export EGO_DEBUG=true # 默认日志输出到logs目录,开启dev后日志输出到终端
go run main.go --config=config.toml

如下所示

图片

这个时候我们可以发送一个指令,得到如下结果

➜  helloworld git:(master) ✗ curl http://127.0.0.1:9001/hello
"Hello Ego"%  

更加友好的包编译

使用scripts文件夹里的包编译,可以看到优雅的version提示

图片

About

简单的Go微服务框架

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0