hyper icon indicating copy to clipboard operation
hyper copied to clipboard

Hello World Example cargo.toml ?

Open nghenglim opened this issue 9 years ago • 4 comments

The hyper hello world example is a .rs file.

Shouldn't it comes with a cargo.toml file so that we can know its dependencies? Just tried that example however service_fn cannot be found in crates.io

nghenglim avatar Jul 16 '17 15:07 nghenglim

Not sure if this answers your question, but the 'examples' directory is a special directory that cargo recognizes for storing examples. To run an example, from the root of the repo, run:

cargo run --example hello

frewsxcv avatar Aug 13 '17 00:08 frewsxcv

The README is suggesting

See the Hello World example for a toy server using hyper

But IMHO for people who want to have a quick try will be expecting something like https://github.com/nghenglim/hello-async-hyper , which can give a better idea of setting up a project with Hyper as a dependencies

nghenglim avatar Aug 13 '17 08:08 nghenglim

I agree with @nghenglim, examples should be self contained and copy-paste:able.

anderejd avatar Aug 13 '17 15:08 anderejd

Just hit this issue as well. Wanted to try hyper, copied the code from the front page. Missing fn main was a trivial fix, but then finding this service_fn crate was kinda hard since it's not on crates.io.

pftbest avatar Aug 27 '17 22:08 pftbest