mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 11:03:53 +08:00
This commit introduces a new `getHeaders` method to the `AngularAppEngine` and `AngularNodeAppEngine` classes, designed to facilitate the retrieval of HTTP headers based on URL pathnames for statically generated (SSG) pages. ```typescript const angularAppEngine = new AngularNodeAppEngine(); app.use(express.static('dist/browser', { setHeaders: (res, path) => { // Retrieve headers for the current request const headers = angularAppEngine.getHeaders(res.req); // Apply the retrieved headers to the response for (const { key, value } of headers) { res.setHeader(key, value); } } })); ``` In this example, the `getHeaders` method is used within an Express application to dynamically set HTTP headers for static files. This ensures that appropriate headers are applied based on the specific request, enhancing the handling of SSG pages.