mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-18 20:02:40 +08:00
Introduced the `createRequestHandler` and `createNodeRequestHandler` utilities to expose middleware functions from the `server.ts` entry point for use with Vite. This provides flexibility in integrating different server frameworks, including Express, Hono, and Fastify, with Angular SSR. Examples: **Express** ```ts export default createNodeRequestHandler(app); ``` **Nest.js** ```ts const app = await NestFactory.create(AppModule); export default createNodeRequestHandler(app); ``` **Hono** ```ts const app = new Hono(); export default createRequestHandler(app.fetch); ``` **Fastify** ```ts export default createNodeRequestHandler(async (req, res) => { await app.ready(); app.server.emit('request', req, res); }); ```
21 lines
624 B
TypeScript
21 lines
624 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.dev/license
|
|
*/
|
|
|
|
export {
|
|
CommonEngine,
|
|
type CommonEngineRenderOptions,
|
|
type CommonEngineOptions,
|
|
} from './src/common-engine/common-engine';
|
|
|
|
export { AngularNodeAppEngine } from './src/app-engine';
|
|
|
|
export { createNodeRequestHandler } from './src/handler';
|
|
export { writeResponseToNodeResponse } from './src/response';
|
|
export { createWebRequestFromNodeRequest } from './src/request';
|
|
export { isMainModule } from './src/module';
|