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

Revamp the website guides #3411

Open
9 of 21 tasks
Tracked by #3068
seanmonstar opened this issue Nov 15, 2023 · 5 comments
Open
9 of 21 tasks
Tracked by #3068

Revamp the website guides #3411

seanmonstar opened this issue Nov 15, 2023 · 5 comments
Labels
A-docs Area: documentation. E-medium Effort: medium. Some knowledge of how hyper internal works would be useful.

Comments

@seanmonstar
Copy link
Member

seanmonstar commented Nov 15, 2023

The guides at https://hyper.rs/guides/1 could use a revamp. They don't explain nearly enough for someone trying to learn. It'd be good for them to be broken up by topic, but also be able to build up to something useful. Here's the outline of guides I've imagined:

  • Init
    • Setup
    • Runtime: Bring Your Own, or hyper_util::rt::Tokio*
  • Server
    • Hello, world!
    • Routing?
    • Streaming (Echo)
    • Testing (your Service)
  • Client
    • Fetch
    • Post
    • Connectors, Pools, HTTPS
  • Bodies
    • Common
    • Advanced: Frames
  • Integrating?
    • Service
    • Middleware. Tower? Client/Server split?
    • Observability (tracing, metrics, etc)
  • Proxy: Put it all together
  • Upgrading from 0.14
@seanmonstar seanmonstar added A-docs Area: documentation. E-medium Effort: medium. Some knowledge of how hyper internal works would be useful. labels Nov 15, 2023
@seanmonstar seanmonstar mentioned this issue Nov 15, 2023
23 tasks
@seanmonstar
Copy link
Member Author

@oddgrd curious what you think of this revamp?

@oddgrd
Copy link
Contributor

oddgrd commented Nov 16, 2023

I think this is good! The 1.0 guides are definitely a bit sparse, and I think building up to a more complete project is a great way to tie it all together. I am a bit out of the loop, but last I checked the documentation for the new crates was quite sparse as well. As these guides are being written, several of which will use these crates, what is missing in them should also become apparent.

As an aside, I have been wanting to learn more about proxies for a while now, so if I can find the time I would love to contribute to this effort!

And finally, congratulations on the release! 🥳

@Vagelis-Prokopiou
Copy link
Contributor

Hi Sean.

I saw the "Connectors, Pools, and HTTPS" section that you added to the Hyper/Client docs within the #1025 issue context. Good addition to the structure of the docs.

I think that the same should be added to the Hyper/Server docs. Overall, we have 2 cases of Hyper usage with TLS.

  1. Hyper server with TLS (HTTPS) support.
  2. Hyper client with TLS (HTTPS) support.

No?

@nyetwurk
Copy link

There is no documentation that covers this https://github.com/hyperium/hyper/pull/2869/files

@nyetwurk
Copy link

Would really like to see example code that replaces this common pattern

...
        let runtime = Runtime::new()?;
        runtime.spawn(async move {
            let make_service = make_service_fn(move |_: &TcpStream| async move {
                Ok::<_, hyper::Error>(service_fn(move |req: Request<Body>| async move {
                    let response = match req.uri().path() {
                        "/hello" => hello_handler(),
                        _ => not_found_handler(),
                    };
                    Ok::<_, hyper::Error>(response)
                }))
        });
...
fn hello_handler() -> Response<Body> {
    let hello: String = ...
    Response::builder().body(Body::from(hello)).unwrap()
}

fn not_found_handler() -> Response<Body> {
    Response::builder()
        .status(StatusCode::NOT_FOUND)
        .body(Body::empty())
        .unwrap()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation. E-medium Effort: medium. Some knowledge of how hyper internal works would be useful.
Projects
None yet
Development

No branches or pull requests

4 participants