blob: 186887d276dc19d6acd0b3a57fe68ba91dbf8658 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import type { SSRManifest } from 'astro';
import { App } from 'astro/app';
import { handle } from '@astrojs/cloudflare/handler';
import { handleSchedule } from './functions/scheduled';
import type { ExecutionContext } from '@cloudflare/workers-types';
export function createExports(manifest: SSRManifest) {
const app = new App(manifest);
return {
default: {
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
// @ts-expect-error - https://github.com/withastro/astro/issues/14038
return handle(manifest, app, request, env, ctx);
},
async scheduled(controller: ScheduledController, env: Env, ctx: ExecutionContext) {
return await handleSchedule(controller, env, ctx);
}
} satisfies ExportedHandler<Env>
};
}
|