astro/benchmark/packages/timer/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

18 lines
506 B
TypeScript

import type { SSRManifest } from 'astro';
import { NodeApp, applyPolyfills } from 'astro/app/node';
import type { IncomingMessage, ServerResponse } from 'node:http';
applyPolyfills();
export function createExports(manifest: SSRManifest) {
const app = new NodeApp(manifest);
return {
handler: async (req: IncomingMessage, res: ServerResponse) => {
const start = performance.now();
await app.render(req);
const end = performance.now();
res.write(end - start + '');
res.end();
},
};
}