Example of building a web service and client with Iron and Hyper

I needed to create a web service and client that speak JSON and I wrote down my process of figuring out how to use Iron and Hyper. Maybe it will be of interest to somebody.

5 Likes

I sit here waiting a while expecting it to print "On 3000" but it never does. Cargo
must be capturing output.

I believe Iron::new(hello_world).http("localhost:3000").unwrap(); blocks.

Thanks for post! Waiting long time for tutorials for Rust + Web

Yea it has to, because when the main thread would reach the end of main, then all remaining threads would get exited, which means the webserver would die instantly.

Nice tutorial!

If you are looking for a template engine for Iron to create server-rendered web pages, here is my handlebars-iron for you:

@sunng thanks for the link!