angular - Angular 通用 SSR 在 localhost 上工作但在 netlify 上不工作
问题描述
我正在尝试使用它来学习 Angular Universal,nestjs
它似乎在我的 localhost 端口 4000 上运行良好,但是当在 Netlify 上进行构建时,我可以看到该站点正在运行,但 Angular Universal 无法运行。
我npm run serve:ssr
在本地主机中使用来运行项目。而在 netlify 中,我已经配置了构建和部署设置,如下图所示。
我的直播网站点击这里
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';
你能帮我做错什么吗?为什么在查看源代码时看不到内容?为什么它只在我的 localhost:4000 上工作
解决方案
推荐阅读
- javascript - 如何在Javascript中根据条件动态包含对象值?
- ldap - 如何在连接到 Keycloak 的 OpenLdap 中读取嵌套组
- sh - sh:比较两个文件后无法返回一个结果
- android - 如何设置服务器以使用 react-native-video 流式传输视频?
- amazon-web-services - 在没有 GCS 的情况下使用 colab TPU
- asp.net - 根路径和文件上传控制
- r - 如何在R中的函数中有不同数量的具有默认值的参数?
- javascript - 滚动到相应部分时无法添加类或样式
- javascript - three.js 中的分层纹理
- python - 美丽的汤 id 对象 null