Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update quickstart.md #82

Open
wants to merge 1 commit into
base: feat/v3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions docs/tasks/grpc/server/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,27 @@ ListenOn: 127.0.0.1:8080
<TabItem value="server.go" label="server.go" default>

```go
package main

import (
"context"
"helloworld/greet"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project name is demo, not helloworld


"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
)

func main() {
func main() {
var serverConf zrpc.RpcServerConf
conf.MustLoad("etc/greet-server.yaml", &serverConf)
s := zrpc.MustNewServer(serverConf, func(server *grpc.Server) {
greet.RegisterGreetServer(server, &exampleServer{})
s := zrpc.MustNewServer(serverConf, func(s *grpc.Server) {
greet.RegisterGreetServer(s, &exampleServer{})
})

defer s.Stop()
s.Start()
}
}

type exampleServer struct {
greet.UnimplementedGreetServer
Expand All @@ -88,4 +97,4 @@ func (e *exampleServer) Ping(ctx context.Context, request *greet.Request) (*gree

- <a href="/docs/tutorials/cli/rpc" target="_blank"> 《goctl rpc 代码生成》 </a>
- <a href="/docs/tutorials/grpc/client/configuration" target="_blank"> 《rpc 客户端配置》 </a>
- <a href="/docs/tutorials/grpc/client/conn" target="_blank"> 《rpc 服务连接》 </a>
- <a href="/docs/tutorials/grpc/client/conn" target="_blank"> 《rpc 服务连接》 </a>