From 5928009fa0f3dc3f2612f764d837093533e76950 Mon Sep 17 00:00:00 2001 From: chenzhihui Date: Wed, 17 Feb 2021 17:34:19 +0800 Subject: [PATCH] add docs related --- README.md | 26 +++++++++++++++++++++++--- config/README.md | 6 +++++- registry/README.md | 4 ++++ 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 registry/README.md diff --git a/README.md b/README.md index 55270151c..dd0d781ad 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,6 @@ Kratos 一套轻量级 Go 微服务框架,包含大量微服务相关框架及 * Tracing:遵循 OpenTracing 规范定义,以实现微服务链路追踪; * Encoding:支持Accept和Content-Type进行自动选择内容编码; * Transport:通用的 HTTP/gRPC 传输层,实现统一的 Middleware 插件支持; -* Server:进行基础的 Server 层封装,统一以 Options 方式配置使用; ## Getting Started ### Required @@ -69,15 +68,36 @@ kratos proto add api/helloworld/helloworld.proto # 生成service模板 kratos proto service api/helloworld/helloworld.proto -t internal/service +# 安装生成工具 +make init # 生成api下所有proto文件 make proto -# 编码cmd下所有main文件 +# 编译cmd下所有main文件 make build # 进行单元测试 make test ``` -## Service Layout +### Kratos Run +``` +import "github.com/go-kratos/kratos/v2" +import "github.com/go-kratos/kratos/v2/transport/grpc" +import "github.com/go-kratos/kratos/v2/transport/http" + +httpSrv := http.NewServer(http.Address(":8000")) +grpcSrv := grpc.NewServer(grpc.Address(":9000")) + +app := kratos.New( + kratos.Name("kratos"), + kratos.Version("latest"), + kratos.Server(httpSrv, grpcSrv), +) +app.Run() +``` + +## Example Usage + +* [Examples](https://github.com/go-kratos/examples) * [Service Layout](https://github.com/go-kratos/kratos-layout) ## Community diff --git a/config/README.md b/config/README.md index ea01387d0..be6d0b9f0 100644 --- a/config/README.md +++ b/config/README.md @@ -1,5 +1,9 @@ -# config +# Config +* [Consul](https://github.com/go-kratos/consul) +* [Etcd](https://github.com/go-kratos/etcd) +* [Kube](https://github.com/go-kratos/kube) +### Example Usage 可以指定多个配置源,config 会进行合并成 map[string]interface{},然后通过 Scan 或者 Value 获取值内容; ``` diff --git a/registry/README.md b/registry/README.md new file mode 100644 index 000000000..e7ec327da --- /dev/null +++ b/registry/README.md @@ -0,0 +1,4 @@ +# Registry +* [Consul](https://github.com/go-kratos/consul) +* [Etcd](https://github.com/go-kratos/etcd) +* [Kube](https://github.com/go-kratos/kube)