如何部署Azure Web应用程序-Node.js [英] How to deploy an azure webapp - nodejs

查看:84
本文介绍了如何部署Azure Web应用程序-Node.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是第一次部署Web应用程序,我在这里遵循此操作-

  var config = {数据库:{主机:"db1.mysql.database.azure.com",用户:用户",密码:"password",端口:3306,db:"db1"},服务器: {主机:"127.0.0.1",端口:"3000"}}module.exports =配置 

解决方案

更新

您可以通过git部署Web应用.我为您创建了

重要

我使用vscode,遵循官方文档,无需修改端口,只需遵循直接发布它的步骤即可.我建议您使用 linux ,它将在创建节点Web应用程序时减少很多问题.

您可以阅读

我不熟悉express,但是调试时很正常.该屏幕截图与我的本地操作一致.我们的重点是发布和连接到mysql.请在下面查看本地操作的屏幕截图.

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

In the example it uses npm start, but I have been using node app.js to start my application locally. Also my code is using 127.0.0.1, do I change this to the created URL? When I deployed it, I went to the azure URL and got - azurewebsites.net is currently unable to handle this request. HTTP ERROR 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. I have create a new demo for you. You need change mysql info.

PRIVIOUS

I use vscode, follow the official documentation, no need to modify the port, just follow the steps to directly publish it. I suggest you use linux, it will reduce a lot of problems when creating node web app.

You can read the official documentation carefully. The demo I provided can be downloaded and run. The demo supports connection to mysql.

This screenshot indicates successful release.

I am not familiar with express, but it is normal when debugging. This screenshot is consistent with my local operation. Our focus is on publishing and connecting to mysql. Please see the screenshot of local operation below.

这篇关于如何部署Azure Web应用程序-Node.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆