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.
Tomorrow: implement a state file, so I can store the instance id, and then figure out how I want to calculate a poison ID from that.
With those in hand, I can get the basics up and running, and I can deploy a demo. Though, deploying a demo would mean packaging iocaine4, and I'm not sure I want to do that just yet.
Mppfngh. Bindings are boring, but I'm like... halfway through!