worker.ts — astro Source File
Architecture documentation for worker.ts, a typescript file in the astro codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR fdeb3778_c429_a272_fbd4_14d8961f08a8["worker.ts"] a43816ff_390b_2af0_f40a_203e16834649["handler"] fdeb3778_c429_a272_fbd4_14d8961f08a8 --> a43816ff_390b_2af0_f40a_203e16834649 3b0ab3a2_e162_4aa0_56c9_e1a5ee6f7ccb["cloudflare:workers"] fdeb3778_c429_a272_fbd4_14d8961f08a8 --> 3b0ab3a2_e162_4aa0_56c9_e1a5ee6f7ccb style fdeb3778_c429_a272_fbd4_14d8961f08a8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { handle } from '@astrojs/cloudflare/handler'
import { DurableObject } from 'cloudflare:workers';
export class MyDurableObject extends DurableObject<Env> {
constructor(ctx: DurableObjectState, env: Env) {
// Required, as we're extending the base class.
super(ctx, env)
}
}
export default {
async fetch(request, env, ctx) {
const response = await handle(request, env, ctx);
// Clone response to make headers mutable, add custom header to prove custom entrypoint is used
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: {
...Object.fromEntries(response.headers.entries()),
'X-Custom-Entrypoint': 'true',
},
});
},
async queue(batch, _env) {
let messages = JSON.stringify(batch.messages);
console.log(`consumed from our queue: ${messages}`);
}
} satisfies ExportedHandler<Env>
Domain
Subdomains
Functions
Classes
Dependencies
- cloudflare:workers
- handler
Source
Frequently Asked Questions
What does worker.ts do?
worker.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in worker.ts?
worker.ts defines 2 function(s): default.fetch, default.queue.
What does worker.ts depend on?
worker.ts imports 2 module(s): cloudflare:workers, handler.
Where is worker.ts in the architecture?
worker.ts is located at packages/integrations/cloudflare/test/fixtures/custom-entryfile/src/worker.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/cloudflare/test/fixtures/custom-entryfile/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free