Serving the Angular Universal App with Nest.js
Now that we are going to be serving the Angular app with our Nest.js server, we are going to have to compile them together so that when our Nest.js server is run, it knows where to look for the Universal app. In our server/src/main.ts file there are a couple of key things we need to have in there. Here we create a function bootstrap() and then call it from below.
asyncfunctionbootstrap() {if(environment.production){enableProdMode();}constapp=awaitNestFactory.create(ApplicationModule.moduleFactory());if(module.hot){module.hot.accept();module.hot.dispose(()=>app.close());}awaitapp.listen(environment.port);}bootstrap().then(()=>console.log(`Serverstartedonport${environment.port}`)).catch(err=>console.error(`Serverstartupfailed`,err));
Let’s step through this function line by line.
if(environment.production){enableProdMode();}
This tells the application...