如何部署一个 azure webapp - nodejs [英] How to deploy an azure webapp - nodejs

查看:12
本文介绍了如何部署一个 azure webapp - nodejs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是第一次部署 Web 应用程序,我在这里关注 -

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

解决方案

更新

您可以通过 git 部署您的 webapp.我为您创建了

私人

我用的是vscode,按照官方文档,不需要修改端口,直接按照步骤发布即可.我建议你使用linux,它会减少很多创建node web app时的问题.

您可以阅读

我不熟悉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 webapp - nodejs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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