简体   繁体   English

如何部署 azure webapp - nodejs

[英]How to deploy an azure webapp - nodejs

I am deploying a web app for the first time, I am following this here - https://docs.microsoft.com/en-us/azure/developer/javascript/tutorial-vscode-azure-app-service-node-03我第一次部署 web 应用程序,我在这里关注 - https://docs.microsoft.com/en-us/azure/developer/javascript/tutorial-vscode-azure-app-service-node-03

In the example it uses npm start, but I have been using node app.js to start my application locally.在示例中它使用 npm 启动,但我一直使用 node app.js 在本地启动我的应用程序。 Also my code is using 127.0.0.1, do I change this to the created URL?另外我的代码使用的是 127.0.0.1,我是否将其更改为创建的 URL? When I deployed it, I went to the azure URL and got - azurewebsites.net is currently unable to handle this request.当我部署它时,我去了 azure URL 并得到 - azurewebsites.net 目前无法处理此请求。 HTTP ERROR 500. HTTP 错误 500。

Thank you for any hep!谢谢你的任何帮助!

在此处输入图像描述 在此处输入图像描述

var config = {
    database: {
        host:     'db1.mysql.database.azure.com',   
        user:     'user',       
        password: 'password',       
        port:     3306,         
        db:       'db1'     
    
    },
    server: {
        host: '127.0.0.1',
        port: '3000'
    }
}



module.exports = config

UPDATE更新

You can deploy your webapp by git.您可以通过 git 部署您的 webapp。 I have create a new demo for you.我为你创建了一个新的演示 You need change mysql info.您需要更改 mysql 信息。

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

PRIVIOUS私人的

I use vscode, follow the official documentation, no need to modify the port, just follow the steps to directly publish it.我用的是vscode,按照官方文档,不需要修改端口,直接按照步骤发布即可。 I suggest you use linux , it will reduce a lot of problems when creating node web app.我建议你使用linux ,它会在创建节点 web 应用程序时减少很多问题。

在此处输入图像描述

You can read the official documentation carefully.可以仔细阅读官方文档 The demo I provided can be downloaded and run.我提供的demo可以下载运行。 The demo supports connection to mysql.该演示支持连接到 mysql。

This screenshot indicates successful release.此屏幕截图表示成功发布。

在此处输入图像描述

I am not familiar with express, but it is normal when debugging. express我不熟悉,但是调试的时候是正常的。 This screenshot is consistent with my local operation.这个截图和我本地的操作一致。 Our focus is on publishing and connecting to mysql.我们的重点是发布和连接到 mysql。 Please see the screenshot of local operation below.请看下面的本地操作截图。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM