Complete the code to import the Angular Universal module in a server-side app.
import { [1] } from '@angular/platform-server';
The ServerModule is imported from '@angular/platform-server' to enable server-side rendering with Angular Universal.
Complete the code to bootstrap the Angular Universal server app.
export function app() {
return express().engine('html', ngExpressEngine({
bootstrap: [1]
}));
}The AppServerModule is the main module bootstrapped for Angular Universal server-side rendering.
Fix the error in the Angular Universal server setup by completing the missing import.
import { ngExpressEngine } from '@nguniversal/express-engine'; import * as express from 'express'; import { [1] } from './src/main.server';
The AppServerModule must be imported from the server main file to set up Angular Universal correctly.
Fill both blanks to create a simple Express server using Angular Universal.
const server = express(); server.engine('html', [1]({ bootstrap: [2] }));
The ngExpressEngine is used as the template engine, and AppServerModule is bootstrapped for server-side rendering.
Fill all three blanks to complete the Angular Universal server listen setup.
server.listen([1], () => { console.log(`Node server listening on http://localhost:[2]`); [3]; });
The server listens on port 3000. The console logs a message confirming the server start.