renderização do lado do servidor em agular
//first step:
ng add @nguniversal/express-engine
//second step:
npm run dev:ssr
//third step:
ng build && ng run app-name:server
//fourth step:
npm run serve:ssr
//fifth step:
npm run prerender
//sixth step:
npm run serve:ssr
//diff method:
ng add @nguniversal/express-engine
//angular.json file change:
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist-server",
"main": "server.ts",
"tsConfig": "tsconfig.server.json",
"inlineStyleLanguage": "scss"
},
//package.json file change:
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"dev:ssr": "ng run test-universal:serve-ssr",
"serve:ssr": "node dist-server/main.js",
"build:ssr": "ng build && ng run test-universal:server",
"prerender": "ng run test-universal:prerender"
//run command:
ng run test-universal:server
ng run build:ssr
npm run serve:ssr
30_Savaliya Denish