1
0
mirror of https://github.com/actix/examples synced 2025-06-26 17:17:42 +02:00

refactor: use graduated Html responder

This commit is contained in:
Rob Ede
2024-07-07 00:23:03 +01:00
parent 10aff3cdb1
commit a67c7803e6
13 changed files with 27 additions and 40 deletions

View File

@ -8,7 +8,6 @@ use actix_web::{
middleware::{ErrorHandlerResponse, ErrorHandlers},
web, App, HttpResponse, HttpServer, Responder, Result,
};
use actix_web_lab::respond::Html;
use handlebars::{DirectorySourceOptions, Handlebars};
use serde_json::json;
@ -19,7 +18,7 @@ async fn index(hb: web::Data<Handlebars<'_>>) -> impl Responder {
});
let body = hb.render("index", &data).unwrap();
Html(body)
web::Html::new(body)
}
#[get("/{user}/{data}")]
@ -31,7 +30,7 @@ async fn user(hb: web::Data<Handlebars<'_>>, path: web::Path<(String, String)>)
});
let body = hb.render("user", &data).unwrap();
Html(body)
web::Html::new(body)
}
#[actix_web::main]