I am trying to learn Angular Universal using nestjs It seems to be working fine at my localhost port 4000 but when the build is made on Netlify I can see the site is working but the Angular Universal is not working.
I use npm run serve:ssr in my localhost to run the project. Whereas in netlify I have configured the build and deploy setting as below screenshot.
My live site click here
package.json
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"dev:ssr": "ng run bharatas:serve-ssr",
"serve:ssr": "node dist/bharatas/server/main.js",
"build:ssr": "ng build --prod && ng run bharatas:server:production",
"prerender": "ng run bharatas:prerender",
"prebuild:ssr": "ngcc"
},
server/app.module.ts
import { Module } from '@nestjs/common';
import { AngularUniversalModule } from '@nestjs/ng-universal';
import { join } from 'path';
import { AppServerModule } from '../src/main.server';
@Module({
imports: [
AngularUniversalModule.forRoot({
bootstrap: AppServerModule,
viewsPath: join(process.cwd(), 'dist/bharatas/browser')
})
]
})
export class AppModule {}
server.ts
import 'zone.js/dist/zone-node';
import './server/main';
export * from './src/main.server';
Can you help me what I am doing wrong. Why can't I see content while I do view source ? Why it is working on only my localhost:4000
