update readme
This commit is contained in:
parent
59685a4ff9
commit
bd34d39401
@ -327,7 +327,7 @@ Go-micro includes the notion of middleware as wrappers. The client or handlers c
|
|||||||
|
|
||||||
Here's an example service handler wrapper which logs the incoming request
|
Here's an example service handler wrapper which logs the incoming request
|
||||||
|
|
||||||
```
|
```go
|
||||||
// implements the server.HandlerWrapper
|
// implements the server.HandlerWrapper
|
||||||
func logWrapper(fn server.HandlerFunc) server.HandlerFunc {
|
func logWrapper(fn server.HandlerFunc) server.HandlerFunc {
|
||||||
return func(ctx context.Context, req server.Request, rsp interface{}) error {
|
return func(ctx context.Context, req server.Request, rsp interface{}) error {
|
||||||
@ -339,7 +339,7 @@ func logWrapper(fn server.HandlerFunc) server.HandlerFunc {
|
|||||||
|
|
||||||
It can be initialised when creating the service
|
It can be initialised when creating the service
|
||||||
|
|
||||||
```
|
```go
|
||||||
service := micro.NewService(
|
service := micro.NewService(
|
||||||
micro.Name("greeter"),
|
micro.Name("greeter"),
|
||||||
// wrap the handler
|
// wrap the handler
|
||||||
@ -351,7 +351,7 @@ service := micro.NewService(
|
|||||||
|
|
||||||
Here's an example of a client wrapper which logs requests made
|
Here's an example of a client wrapper which logs requests made
|
||||||
|
|
||||||
```
|
```go
|
||||||
type logWrapper struct {
|
type logWrapper struct {
|
||||||
client.Client
|
client.Client
|
||||||
}
|
}
|
||||||
@ -369,7 +369,7 @@ func logWrap(c client.Client) client.Client {
|
|||||||
|
|
||||||
It can be initialised when creating the service
|
It can be initialised when creating the service
|
||||||
|
|
||||||
```
|
```go
|
||||||
service := micro.NewService(
|
service := micro.NewService(
|
||||||
micro.Name("greeter"),
|
micro.Name("greeter"),
|
||||||
// wrap the client
|
// wrap the client
|
||||||
|
Loading…
x
Reference in New Issue
Block a user