代码之家  ›  专栏  ›  技术社区  ›  AndrewMemo

Express应用程序在Azure上成功部署,但仍然无法运行

  •  0
  • AndrewMemo  · 技术社区  · 4 年前

    Azure已成功部署此应用程序,但主页响应为500状态

    index.js:

    const express = require("express");
    
    const app = express();
    
    app.get("/", (req, res) => {
      res.send("Hello!");
    });
    
    app.listen(3000, () => console.log("Hwllo!"));
    
    

    package.json:

      "name": "test",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "start": "node index.js",
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "keywords": [],
      "author": "",
      "license": "ISC",
      "dependencies": {
        "express": "^4.17.1"
      }
    }
    
    0 回复  |  直到 4 年前
        1
  •  0
  •   Sajeetharan    4 年前

    你试过设置变量吗 process.env.PORT 用于处理Azure应用服务中的指定管道端口。请参阅侦听其他端口Microsoft Azure Nodejs。

    如果它不能解决您的问题,请尝试通过KUDU控制台查找特定的错误。