Shawn
Shawn

Reputation: 2435

Web app not updating after publishing build folder to wwwroot

I am trying to publish a React application to a web app service but I am only seeing this page when I navigate to my url.

enter image description here

I am using FTP to load the output of my create-react-app build directory to the wwwroot folder in the app service. I can verify these have been moved over correctly via shelling into the app service.

enter image description here

After I publish the files via FTP, I would restart the app service, but I only continue to see the default app service page instead of my index.html. I am not sure where to really go from here, but I feel like the app service server is still caching the old initial default page?

Upvotes: 4

Views: 2203

Answers (1)

suziki
suziki

Reputation: 14108

Your problem comes because the linux azure app service is different from windows azure app service. Linux app service don't have default documents so you need to set. So follow the steps below:

1.add a file name index.js under the site/wwwroot.

index.js:

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);

2.install express:

run this command under the wwwroot directory,

npm install -save express

3.restart your app service and wait for minutes.

Upvotes: 8

Related Questions