askama: Missing examples / explanations

  • a much more prominent link in our docs, that you should rather read the book
  • a book page to explain the feature flags
  • a minimal axum example
  • a minimal rocket example
  • a minimal warp example
  • a minimal poem example
  • a minimal salvo example
  • a page in the book to lead you to the examples
  • ↑ maybe including an explanation how to turn a Result<String, rinja::Error> into a response (Ok → status: 200, text/html; Err → error response)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 17 (3 by maintainers)

Most upvoted comments

I never used axum before, and this is what I came up with by skimming their docs:

async fn handler() -> Result<Response, AppError> {
    let tmpl = Template { … };
    Ok(Html(tmpl.render()?).into_response())
}

https://github.com/rinja-rs/rinja/blob/070538957c2176042da1be8ffbe4a279bd90c9b4/examples/axum-app/src/main.rs#L102-L130

Dunno if it’s idiomatic, but I don’t think it couldn’t be any simpler if you want stylized error pages instead of just a text message. I don’t think a wrapper library offers any actual advantage, do you?