const ENGINE: generators.upon.Engine = generators.upon.Engine.new();
const TEMPLATE: generators.upon.Template = match ENGINE.compile("Hello {{ name }}!") {
Ok(v) => v,
Err(_) => ENGINE.empty_template(),
};
fn output(request: Request, decision: Decision) -> Result[Response, Report] {
let ctx = generators.upon.value.map();
ctx.insert_string("name", "World");
let output = match ENGINE.render(TEMPLATE, ctx) {
Ok(v) => v,
Err(e) => return Err(e),
};
Ok(Response.new(output.as_bytes()).set_header("content-type", "text/plain"))
}
=>
HTTP/1.1 200 OK
content-type: text/plain
Hello World!⏎
Oooooh yeah.