@written/mkctx
v0.3.18
Published
Generate Appwrite Context Objects
Downloads
11
Readme
@written/mkctx
Generate Appwrite Context Objects. Useful for testing & making non-appwrite-runner calls to appwrite functions.
See also: @written/httpcompat
Installation
pnpm i @written/mkctx
Usage
The ctx
constructor takes the same args as fetch()
.
Example:
import Ctx from '@written/mkctx';
const ctx = new Ctx('https://example.com/test', {
method: 'POST',
});
// ...
(async () => {
const response = await import('./someAppwriteFunc').default(ctx);
// todo: handle response
})();
Obtaining Logs
You can use Ctx.getLogs(ctx)
/Ctx.getErrors(ctx)
to get the logs from the context object.