简体   繁体   中英

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

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.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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