summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/src/netlify-edge-functions.ts
blob: f7000442c2c170221f24ea473a1b8f4bff8c1727 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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> => {
		if(app.match(request)) {
			return app.render(request);
		}

		return new Response(null, {
			status: 404,
			statusText: 'Not found'
		});
	};

	return { 'default': handler };
}