2020-09-24 22:54:01 +00:00
|
|
|
use actix_web_codegen::*;
|
2020-09-16 21:37:41 +00:00
|
|
|
|
|
|
|
#[route("/", method="GET", method="HEAD")]
|
2020-09-24 22:54:01 +00:00
|
|
|
async fn index() -> String {
|
|
|
|
"Hello World!".to_owned()
|
2020-09-16 21:37:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[actix_web::main]
|
|
|
|
async fn main() {
|
2021-04-02 07:26:59 +00:00
|
|
|
use actix_web::App;
|
2020-09-24 22:54:01 +00:00
|
|
|
|
2021-04-02 07:26:59 +00:00
|
|
|
let srv = actix_test::start(|| App::new().service(index));
|
2020-09-16 21:37:41 +00:00
|
|
|
|
|
|
|
let request = srv.get("/");
|
|
|
|
let response = request.send().await.unwrap();
|
|
|
|
assert!(response.status().is_success());
|
|
|
|
}
|