function decide(request)
return iocaine.decision.Passthrough("foo")
end
❯ cargo run -- runtime decide
Anarchism("foo")
Awoo!
function decide(request)
return iocaine.decision.Passthrough("foo")
end
❯ cargo run -- runtime decide
Anarchism("foo")
Awoo!
Hah, the first bullshit generator binding was a bit of a pain, the second one was a breeze.
Marvel at this beautiful thing!
function output(request, decision)
local rng = iocaine.generators.rng:from_seed(request.path);
local fjdata = iocaine.file.read("tmp/fakejpeg.msgpack");
local fj = iocaine.generators.FakeJpeg(fjdata);
local body = fj:generate(rng)
local response = iocaine.http.Response(body);
response:set_header("content-type", "image/jpeg")
return response
end
function decide(request)
local err = iocaine.Error("teh root cause")
:help("I am helpful!")
:code("[foo:bar]")
:url("https://example/")
:wrap("wrapping")
return nil, err
end
=>
❯ cargo run -q -- runtime decide
Error: [foo:bar] (https://example/)
× Failed to run `decide()` for http-server `default`
├─▶ wrapping
╰─▶ teh root cause
help: I am helpful!
Neat, neat.
Mppfngh. Bindings are boring, but I'm like... halfway through!