Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 719
Shawn Avatar asked Mar 04 '23 10:03

Shawn


1 Answers

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.

like image 199
Cindy Pau Avatar answered Mar 07 '23 15:03

Cindy Pau