【问题标题】:how to deploy angular 6 app to azure node.js empty webapp如何将 Angular 6 应用程序部署到 azure node.js 空 webapp
【发布时间】:2018-10-24 13:46:21
【问题描述】:

我曾经将我的 Angular 应用程序部署到 azure Web 应用程序。并想尝试使用 nodejs webapp。

谁能帮助我执行此操作的步骤是什么?这与我从 dist 文件夹复制文件并将其放在 d:\home\wwwroot\sites\

的其他 webapp 相同吗

现在,当我将内容转储到 nodejs webapp 的 \site 文件夹中时。我刚刚收到“Hello world”消息。这是该位置的 server.js:

var http = require('http');

http.createServer(function (req, res) {

    res.writeHead(200, { 'Content-Type': 'text/html' });
    res.end('Hello, world!');

}).listen(process.env.PORT || 8080);

谢谢

【问题讨论】:

    标签: node.js angular angular6 azure-node-sdk


    【解决方案1】:

    您可能希望首先构建您的 Angular 应用程序。检查 package.json 中的构建命令,但通常是 npm run build

    然后将 dist 文件夹的内容(或输出文件夹的名称)放在 nodejs 应用程序的 public 文件夹中。这样 index.html 的路径最终会变成 /public/index.html。

    现在运行你的节点服务器,你应该可以在 localhost:your-port/ 看到页面

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-05
      • 2023-03-05
      • 1970-01-01
      • 2021-11-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多