【发布时间】:2020-08-14 14:34:32
【问题描述】:
我在 Google 应用引擎上有一个 angular 和 expressJS 应用,每次刷新时都会遇到 404 错误页面。我看到人们通过在他们的 app.yaml 文件中使用处理程序来解决这个问题,但是任何这样做的尝试都会破坏我的应用程序 - 在 Express 为 Angular 文件提供服务之前是否有人必须这样做?
GAE 上的项目文件夹结构 ./build ExpressJS 后端逻辑 ./public Angular 9 前端(产品构建)
我的快递服务器如下
...
const app = express()
app.set('views', 'cloud/views') // Specify the folder to find templates
app.set('view engine', 'ejs') // Set the template engine
app.use(bodyParser.json({ limit: '50mb' }));
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
app.use('/backend', api)
// Serve static assets from the /public folder
app.use('/', express.static('./public'))
...
【问题讨论】:
标签: angular express google-app-engine