Skip to content

Commit

Permalink
fix: link ref in middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
NewbMiao committed Mar 10, 2024
1 parent 2d3bfe3 commit c177330
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions _stable/server/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ title: Getting Started with a Server Middleware
layout: guide
---

As [Upgrade](upgrading) mentioned, hyper v1 does not depend on tower for the `Service` trait. When we want to add tower-like middleware, there are 2 kinds of approach to make it.
As [Upgrade][upgrading] mentioned, hyper v1 does not depend on tower for the `Service` trait. When we want to add tower-like middleware, there are 2 kinds of approach to make it.

Let's create a Logger middleware in [hello-world server](hello-world) for instance:
Let's create a Logger middleware in [hello-world server][hello-world] for instance:

Add tower dependency first

Expand Down Expand Up @@ -122,7 +122,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {

## Option 2: use hyper TowerToHyperService trait

[hyper_util::service::TowerToHyperService](adapter-trait) trait is an adapter to convert tower Service to hyper Service.
[hyper_util::service::TowerToHyperService][adapter-trait] trait is an adapter to convert tower Service to hyper Service.

Now implement a tower Logger middleware

Expand Down

0 comments on commit c177330

Please sign in to comment.