0

I am deploying a web app for the first time, I am following this here - https://learn.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!

enter image description here enter image description here

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
williswin
  • 133
  • 13

1 Answers1

1

UPDATE

You can deploy your webapp by git. I have create a new demo for you. You need change mysql info.

enter image description here

enter image description here

enter image description here

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.

enter image description here

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.

enter image description here

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.

enter image description here

Jason Pan
  • 15,263
  • 1
  • 14
  • 29
  • Thanks for the reply Jason. Is there a way for me to use your example but with ejs instead of pug? All my current files are in ejs, converting it will be difficult for me – williswin Jul 08 '20 at 13:16
  • @williswin I have updated my answer, and create a demo for you. Good luck. – Jason Pan Jul 09 '20 at 06:22
  • Thank you Jason. Am I simply able to add the dbconfig.js file to support multiple databases? – williswin Jul 09 '20 at 14:57
  • @williswin https://stackoverflow.com/questions/62400289/azure-database-for-mysql-webapp-nodejs/62425716#62425716 – Jason Pan Jul 09 '20 at 15:43
  • Hi Jason, I have a new question if you have time to look at it. https://stackoverflow.com/questions/62927550/nodejs-webapp-works-locally-but-not-live-deployed – williswin Jul 16 '20 at 15:02
  • @williswin It is recommended to bring the tag of `azure-web-sites` when creating new posts in the future, so that I can find your posts quickly and help you better. – Jason Pan Jul 17 '20 at 01:32