0
0
Angularframework~10 mins

Angular Universal overview - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Angular Universal module in a server-side app.

Angular
import { [1] } from '@angular/platform-server';
Drag options to blanks, or click blank then click option'
AServerModule
BBrowserModule
CHttpClientModule
DAppModule
Attempts:
3 left
💡 Hint
Common Mistakes
Using BrowserModule instead of ServerModule
Importing HttpClientModule which is unrelated here
2fill in blank
medium

Complete the code to bootstrap the Angular Universal server app.

Angular
export function app() {
  return express().engine('html', ngExpressEngine({
    bootstrap: [1]
  }));
}
Drag options to blanks, or click blank then click option'
AAppModule
BServerModule
CBrowserModule
DAppServerModule
Attempts:
3 left
💡 Hint
Common Mistakes
Using AppModule instead of AppServerModule
Using BrowserModule which is client-side only
3fill in blank
hard

Fix the error in the Angular Universal server setup by completing the missing import.

Angular
import { ngExpressEngine } from '@nguniversal/express-engine';
import * as express from 'express';
import { [1] } from './src/main.server';
Drag options to blanks, or click blank then click option'
AAppServerModule
BAppModule
CServerModule
DBrowserModule
Attempts:
3 left
💡 Hint
Common Mistakes
Importing AppModule instead of AppServerModule
Importing BrowserModule which is client-side only
4fill in blank
hard

Fill both blanks to create a simple Express server using Angular Universal.

Angular
const server = express();
server.engine('html', [1]({ bootstrap: [2] }));
Drag options to blanks, or click blank then click option'
AngExpressEngine
BAppModule
CAppServerModule
DBrowserModule
Attempts:
3 left
💡 Hint
Common Mistakes
Using BrowserModule instead of AppServerModule
Using AppModule instead of AppServerModule
5fill in blank
hard

Fill all three blanks to complete the Angular Universal server listen setup.

Angular
server.listen([1], () => {
  console.log(`Node server listening on http://localhost:[2]`);
  [3];
});
Drag options to blanks, or click blank then click option'
A3000
Bport
Cprocess.exit()
Dconsole.log('Server started')
Attempts:
3 left
💡 Hint
Common Mistakes
Using process.exit() which stops the server immediately
Using a variable 'port' without defining it