MCPcopy Create free account
hub / github.com/actix/examples / index

Function index

templating/askama/src/main.rs:17–30  ·  view source on GitHub ↗
(query: web::Query<HashMap<String, String>>)

Source from the content-addressed store, hash-verified

15struct Index;
16
17async fn index(query: web::Query<HashMap<String, String>>) -> Result<impl Responder> {
18 let html = if let Some(name) = query.get("name") {
19 UserTemplate {
20 name,
21 text: "Welcome!",
22 }
23 .render()
24 .expect("template should be valid")
25 } else {
26 Index.render().expect("template should be valid")
27 };
28
29 Ok(web::Html::new(html))
30}
31
32#[actix_web::main]
33async fn main() -> std::io::Result<()> {

Callers

nothing calls this directly

Calls 2

getMethod · 0.80
renderMethod · 0.80

Tested by

no test coverage detected