use response instead of result for asyn c handlers

This commit is contained in:
Nikolay Kim 2019-11-21 15:01:34 +06:00
parent 55698f2524
commit 53c5151692
5 changed files with 43 additions and 59 deletions

View file

@ -8,9 +8,9 @@ fn index(req: HttpRequest, name: web::Path<String>) -> String {
format!("Hello: {}!\r\n", name)
}
async fn index_async(req: HttpRequest) -> Result<&'static str, Error> {
async fn index_async(req: HttpRequest) -> &'static str {
println!("REQ: {:?}", req);
Ok("Hello world!\r\n")
"Hello world!\r\n"
}
#[get("/")]
@ -26,7 +26,7 @@ fn main() -> std::io::Result<()> {
App::new()
.wrap(middleware::DefaultHeaders::new().header("X-Version", "0.2"))
.wrap(middleware::Compress::default())
// .wrap(middleware::Logger::default())
.wrap(middleware::Logger::default())
.service(index)
.service(no_params)
.service(