Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Web App Node deployment, change app root directory?

I am trying to deploy a Node app on an Azure App Service, using Github and Kudu, running on Windows. The deployment works and the app is started.

My codebase is organised as follows:

/config
/res
/src
package.json

and package.json contains node src/start.js.

The problem I am having is that it seems that on that deployment the root directory for the Node app is site/wwwroot/src and not (as on my local machine, or my previous deployment on AWS) site/wwwroot. This leads to my code not finding the files inside /config or /res since the paths used in the code presume that the root is top level, and not inside /src (e.g. ./res/myFile.jpg will try opening site/wwwroot/src/res/myFile.jpg and not site/wwwroot/res/myFile.jpg).

I have been looking around but can't find how to change this. Can anyone help me?

Thanks!

like image 752
Joris Mans Avatar asked Jun 07 '26 06:06

Joris Mans


1 Answers

For those wondering: I didn't solve it but a workaround is to put your entrypoint js file in the root directory. So instead of having node src/index.js you use node index.js, while keeping all your other sources in /src.

like image 200
Joris Mans Avatar answered Jun 10 '26 02:06

Joris Mans