0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-27 22:19:04 -05:00
astro/packages/integrations/node/src/server.ts
Erika 148e61d249 feat: remove webapi in favor of a smaller polyfill (#7840)
* feat: remove webapi in favor of a smaller polyfill

* test: remove old test

* test: 🤦‍♀️

* chore: changeset
2023-08-08 11:01:45 +01:00

23 lines
698 B
TypeScript

import type { SSRManifest } from 'astro';
import { NodeApp, applyPolyfills } from 'astro/app/node';
import middleware from './nodeMiddleware.js';
import startServer from './standalone.js';
import type { Options } from './types';
applyPolyfills();
export function createExports(manifest: SSRManifest, options: Options) {
const app = new NodeApp(manifest);
return {
handler: middleware(app, options.mode),
startServer: () => startServer(app, options),
};
}
export function start(manifest: SSRManifest, options: Options) {
if (options.mode !== 'standalone' || process.env.ASTRO_NODE_AUTOSTART === 'disabled') {
return;
}
const app = new NodeApp(manifest);
startServer(app, options);
}