-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed as not planned
Closed as not planned
Copy link
Description
Describe the problem that you experienced
I am attempting to migrate from Angular 16 to Angular 17. With regards to SSR I am having difficulty figuring how out to migrate my current code from something that looks like:
import { ngExpressEngine } from '@nguniversal/express-engine';
const compressor = compression();
server.use('*.js', compressor);
server.use((req, res, next) => {
const mimeType = mime.getType(req.url);
if (mimeType) {
res.setHeader('Content-Type', mimeType);
}
next();
});
server.engine(
'html',
ngExpressEngine({
bootstrap: AppServerModule,
})
);
server.set('view engine', 'html');
server.set('views', distFolder);
// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get(
'*.*',
express.static(distFolder, {
maxAge: '1y',
})
);
over to the new angular syntax of 17
server.get('*', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;
commonEngine
.render({
bootstrap,
documentFilePath: indexHtml,
url: `${protocol}://${headers.host}${originalUrl}`,
publicPath: browserDistFolder,
providers: [{ provide: APP_BASE_HREF, useValue: req.baseUrl }],
})
.then((html) => res.send(html))
.catch((err) => next(err));
});
A before and after of something above would be very helpful. Especially what is used in place of express engine e.g. just replaced within commonEngine
Enter the URL of the topic with the problem
NA
Describe what you were looking for in the documentation
A way to translate how I should change my Angular 16 SSR code to work with Angular 17. Particularly within the server.ts file
Describe the actions that led you to experience the problem
Unable being able to migrate from Angular 16 to Angular 17 in a timely fashion
Describe what you want to experience that would fix the problem
A before and after code block within angular.dev
Add a screenshot if that helps illustrate the problem
NA
If this problem caused an exception or error, please paste it here
No response
If the problem is browser-specific, please specify the device, OS, browser, and version
NA
Provide any additional information here in as much as detail as you can
No response
Metadata
Metadata
Assignees
Labels
No labels