summaryrefslogtreecommitdiff
path: root/src/worker.ts
blob: e982634e87814340a3d354bcddce2097c290233d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import type { SSRManifest } from 'astro';
import { App } from 'astro/app';
import { handle } from '@astrojs/cloudflare/handler';
import { handleSchedule } from './functions/scheduled';

export function createExports(manifest: SSRManifest) {
  const app = new App(manifest);
  return {
    default: {
      async fetch(request, env, ctx) {
        return handle(manifest, app, request, env, ctx);
      },
      async scheduled(controller, env, ctx) {
        return await handleSchedule(controller, env, ctx);
      }
    }
  };
}