Open aquapi opened 1 month ago
@emastho
Let's start with this, I think that one of the biggest problems with plugging is the way that we have to unwrap the plugin:
const hello = plugin.type({
name: Symbol.for("Unique Identifier"),
type: "string",
f: () => () => () => "hello world",
})
const serve = wrap({
cyclePlugin:{
hello
}
})()
.get({
path: "/",
f: ctx => ctx.hello
})
// Code below will be replaced by `.serve()`
// On the next update
.testRequests()
await serve(
new Request('http://localhost/')
).then(r => r.text())
.then( console.log)
Where f
is curried and that could be bothersome for some programmers
As Vix uses dynamic code generation for optimizing request handling, it would be great to fully leverage that with an API that allows developers to directly inject code into the control flow.
This can be used to optimize things such as request validation since it can inline code directly into the handler.