mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 22:49:21 +02:00
use response instead of result for asyn c handlers
This commit is contained in:
@ -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(
|
||||
|
Reference in New Issue
Block a user