(data: web::Data<AppState>)
| 63 | |
| 64 | #[get("/new")] |
| 65 | async fn new(data: web::Data<AppState>) -> Result<HttpResponse, Error> { |
| 66 | let template = &data.templates; |
| 67 | let ctx = tera::Context::new(); |
| 68 | let body = template |
| 69 | .render("new.html.tera", &ctx) |
| 70 | .map_err(|_| error::ErrorInternalServerError("Template error"))?; |
| 71 | Ok(HttpResponse::Ok().content_type("text/html").body(body)) |
| 72 | } |
| 73 | |
| 74 | #[post("/")] |
| 75 | async fn create( |
no outgoing calls