#[macro_use] extern crate rocket; mod async_required; #[get("/")] fn hello() -> &'static str { "Hello, world!" } #[launch] fn rocket() -> rocket::Rocket { async_required::rocket().mount("/", routes![hello]) } #[cfg(test)] mod test { use super::rocket; use rocket::http::Status; #[test] fn test_hello() { use rocket::local::blocking::Client; let client = Client::new(rocket()).unwrap(); let response = client.get("/").dispatch(); assert_eq!(response.status(), Status::Ok); assert_eq!(response.into_string(), Some("Hello, world!".into())); } }