blob: 35f9714a48ef96fb899475e0acfb5b59f18c3977 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import './edge-shim.js';
import { SSRManifest } from 'astro';
import { App } from 'astro/app';
export function createExports(manifest: SSRManifest) {
const app = new App(manifest);
const handler = async (request: Request): Promise<Response | void> => {
const url = new URL(request.url);
// If this matches a static asset, just return and Netlify will forward it
// to its static asset handler.
if (manifest.assets.has(url.pathname)) {
return;
}
if (app.match(request)) {
return app.render(request);
}
return new Response(null, {
status: 404,
statusText: 'Not found',
});
};
return { default: handler };
}
|