简体   繁体   中英

Host static HTML in Azure Web App Service

I'm azure beginner

I've created nodejs service and deployed it to Azure Web App service, it works as expected. So, I have resource group mars-app and existing Web App service application my-mars-web-app .

Now, I want to add static HTML file, to show it when user goes to root URL https://***.azurewebsites.net/

To achieve it,

  1. I have cloned github repo with client side to azure storage with azure cli help
  2. In cliend code folder, I have tried to run az webapp up -g mars-app -n my-mars-web-app --html , but every time I'm receiving:

The webapp my-mars-web-app is a Linux app. The code detected at '/home/serhii/azure-website' will default to '<module 'os' from '/opt/az/lib/python3.6/os.py'>'. Please create a new app to continue this operation.

Because of above error, I have added index.html to dist diretory in my backend app

 app.get('/', function (req, res) {
   res.sendfile('dist/index.html');
 }); 

and it works. But I'm not sure it is a good solution

What the best practice to add static HTML files to existing Web App service?

This question may be a dublicate of this question , but it was asked 5 years ago, so maybe something changed.

PS I know about Static Web Apps , but it is in preview and I'm interested in more generic solutions.

Thanks in advance

[UPDATE] Here an article about deploying react app

Why you want to add static HTML files to existing web app services, for update or others ?

In my opinon, now that you have used git, you can use continuous deployment .

When you modify your program (add new or modify files), in the Action of github, you will see the program start to deploy again. This should be the best deployment plan.

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