dependabot[bot] on npm_and_yarn
build(deps-dev): bump jest from… (compare)
dependabot[bot] on npm_and_yarn
dependabot[bot] on npm_and_yarn
build(deps-dev): bump jest from… (compare)
Hi guys, a question for you:
tl;dr: Trying to create a mock context like this:
const ctx = createContext({
method,
headers,
body,
});
throws TypeErrors
https://stackoverflow.com/questions/57864117/koa-create-context-cannot-set-headers-or-body
stream.end()
is called). I changed my stream writer to be something a bit more complex, like this, which vaguely what they say to do anyway in the Writable stream docs, const writer = (stream) => (obj) => {
return new Promise((resolve) => {
if (!stream.write(obj)) {
stream.once('drain', resolve);
} else {
process.nextTick(resolve);
}
});
};
.end()
but I could be mistaken on that
I intend to create an application and reuse some app logic by forwarding an API call from one route to another.
for example. A request is made for /subscribed-users and i want to add to this context and call the /users route internally.
How can i achieve this with KOA?
Any help would be welcome.
Thanks.
function Property {
this.something = 'Something'
}
Property.prototype.test = require( './test.js' )
module.exports = Property
That there, the test file will have access to the context right?
this.something
will exist in Property.test
Property.test.a
and still persist the this
context