herenickname
herenickname
Explore posts from servers
CDCloudflare Developers
Created by herenickname on 2/19/2025 in #workers-help
How to create a binding TS types from RPC worker?
thank you!!!
6 replies
CDCloudflare Developers
Created by herenickname on 2/19/2025 in #workers-help
How to create a binding TS types from RPC worker?
Can I call a Durable Object from a worker of another wrangler project? I want to separate DO and api-workers that call them into different projects. So in this example I want to do this: /DOs/src/index.ts:
export class MyDurableObject extends DurableObject {
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env);
}

async sayHello(): Promise<string> {
return "Hello, World!";
}
}
export class MyDurableObject extends DurableObject {
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env);
}

async sayHello(): Promise<string> {
return "Hello, World!";
}
}
/api/src/index.ts:
export default {
async fetch(request, env) {
// Every unique ID refers to an individual instance of the Durable Object class
const id = env.MY_DURABLE_OBJECT.idFromName("foo");

// A stub is a client used to invoke methods on the Durable Object
const stub = env.MY_DURABLE_OBJECT.get(id);

// Methods on the Durable Object are invoked via the stub
const rpcResponse = await stub.sayHello();

return new Response(rpcResponse);
},
} satisfies ExportedHandler<Env>;
export default {
async fetch(request, env) {
// Every unique ID refers to an individual instance of the Durable Object class
const id = env.MY_DURABLE_OBJECT.idFromName("foo");

// A stub is a client used to invoke methods on the Durable Object
const stub = env.MY_DURABLE_OBJECT.get(id);

// Methods on the Durable Object are invoked via the stub
const rpcResponse = await stub.sayHello();

return new Response(rpcResponse);
},
} satisfies ExportedHandler<Env>;
6 replies
DDeno
Created by herenickname on 8/30/2024 in #help
Several commands at once
new Deno.Command('sh', { args: ['-c', command] }) works
2 replies
DDeno
Created by herenickname on 8/21/2024 in #help
Unexpected behavior while importing npm module
I forked this package on my github to fix some things. Am I right in thinking that I won't be able to import it locally until I load it into npm? It's pretty hard to adapt the version for deno.
4 replies
DDeno
Created by herenickname on 8/21/2024 in #help
Unexpected behavior while importing npm module
Thanks.
4 replies
DDeno
Created by herenickname on 12/7/2023 in #help
Linter does not warn about lack of constructor arguments.
thank you so much!
9 replies
DDeno
Created by herenickname on 12/7/2023 in #help
Linter does not warn about lack of constructor arguments.
after that I found my code full of undefined errors, but runtime (deno run -A src/main.ts) does not show anything about this. How to preserve runtime to strict check code before run?
9 replies
DDeno
Created by herenickname on 12/7/2023 in #help
Linter does not warn about lack of constructor arguments.
I see that deno check can only process a specific file. How to check the whole folder? Is it possible to combine lint & check output? Is there an abstraction in deno for this?
9 replies