我想将我的MERN堆栈应用程序部署到Azure App Service。到现在为止,无论我遇到什么教程,它们都在同一个目录和server.js文件中都有一个客户端和服务器代码的git repo,它们正在执行此操作:
app.get("*", (req, res) => {
res.sendFile(path.resolve(__dirname, "client", "build", "index.html"));
});
我几乎到处都发现了相同的方法。但就我而言,我有两个不同的git repos,一个用于react应用程序,一个用于node-express应用程序。在我的server.js文件中也有以下代码:
routes.all("*", (_req: any, _res: any, next: any) =>
next(new APIError(
`${_req.originalUrl} is not found on this server`,HTTPStatus.NOT_FOUND,true
)
)
);
所以不确定如何将我的MERN应用部署到天蓝色。可以请人提供指导。
我遵循了以下两个教程: