Saurabh Singh
Saurabh Singh

Reputation: 111

Need to set Default Document and Physical path in Azure Web App

I am not able to see my SPA page after deploying it to Azure WebApp from VS Code. Its says

"Hey, Node developers!

Your app service is up and running. Time to take the next step and deploy your code."

I have seen at so may site that I need to set default document and New physical path. But i don't see any Default Document Tab in Configuration menu of Web App. There are only three tabs. 1- Application Setting 2- General Setting 3- Path Mapping. The Issue is where to set the Default document and new physical path.

Upvotes: 3

Views: 2833

Answers (1)

George Chen
George Chen

Reputation: 14334

If you deployed to a Node Linux Web App the default document would be hostingstart.html located in /home/site/wwwroot/.

According this document:Things You Should Know: Web Apps and Linux, there is a description about default document in a Node.js app.

When you create a Node.js app, by default, it's going to use hostingstart.html as the default document unless you configure it to look for a different file. You can use a JavaScript file to configure your default document. Create a file called index.js in the root folder of your site and add the following content.

So go to your ssh terminal, navigate to /home/site/wwwroot , create the index.js with the following code:

var express = require('express');
var server = express();
var options = {
index: 'index.html'
};
server.use('/', express.static('/home/site/wwwroot', options));
server.listen(process.env.PORT);

Upvotes: 3

Related Questions