add comments
This commit is contained in:
		| @@ -7,7 +7,7 @@ supported. | |||||||
|  |  | ||||||
| 	c := client.NewClient() | 	c := client.NewClient() | ||||||
|  |  | ||||||
| 	req := c.NewRequest("go.micro.srv.greeter", &greeter.Request{ | 	req := c.NewRequest("go.micro.srv.greeter", "Greeter.Hello", &greeter.Request{ | ||||||
| 		Name: "John", | 		Name: "John", | ||||||
| 	}) | 	}) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,6 +6,25 @@ register with a broker. | |||||||
| The server combines the all the packages in go-micro to create a whole unit | The server combines the all the packages in go-micro to create a whole unit | ||||||
| used for building applications including discovery, client/server communication | used for building applications including discovery, client/server communication | ||||||
| and pub/sub. | and pub/sub. | ||||||
|  |  | ||||||
|  | 	import "github.com/micro/go-micro/server" | ||||||
|  |  | ||||||
|  | 	type Greeter struct {} | ||||||
|  |  | ||||||
|  | 	func (g *Greeter) Hello(ctx context.Context, req *greeter.Request, rsp *greeter.Response) error { | ||||||
|  | 		rsp.Msg = "Hello " + req.Name | ||||||
|  | 		return nil | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	s := server.NewServer() | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	s.Handle( | ||||||
|  | 		s.NewHandler(&Greeter{}), | ||||||
|  | 	) | ||||||
|  |  | ||||||
|  | 	s.Start() | ||||||
|  |  | ||||||
| */ | */ | ||||||
| package server | package server | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user