mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 19:13:34 +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); }); ```
20 lines
481 B
TypeScript
20 lines
481 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 * from './private_export';
|
|
|
|
export { AngularAppEngine } from './src/app-engine';
|
|
export { createRequestHandler } from './src/handler';
|
|
|
|
export {
|
|
type PrerenderFallback,
|
|
type ServerRoute,
|
|
provideServerRoutesConfig,
|
|
RenderMode,
|
|
} from './src/routes/route-config';
|