Deploy a Node js app to the Azure App service virtual applications.

Mounik Narasimha 40 Reputation points
2025-11-05T13:43:29.5166667+00:00

Created a virtual application inside a app service with path site/wwwroot/api. How to ensure that app service runs npm install and npm start within api virtual application.

By default, I have a react app in the site/wwwroot.

deploying react app is working fine but deployment to site/wwwroot/api is not running npm install and npm start and is also deleting the react app artifacts. I do have SCM_DO_BUILD_DURING_DEPLOYMENT = true in the app service

How to ensure both of them works and deploys seamlessly

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
{count} votes

Answer accepted by question author
  1. Vimal Lalani 2,400 Reputation points Microsoft External Staff Moderator
    2025-11-05T14:20:58.3166667+00:00

    Hi @Mounik Narasimha

    Thank you for posting your question on Microsoft Q&A.

    Based on your description, it appears you have configured a React application running under the root directory (site/wwwroot) and a Node.js application within a virtual directory (site/wwwroot/api) in the same Azure App Service. The issue is that the App Service build process runs only once for the root application and does not automatically execute npm install or npm start for applications located in subfolders, such as your api directory.

    The best practice is to host the React frontend and the Node.js backend as separate applications. You can deploy Node.js app to another Azure Web App or Azure Function App. Then, update your React frontend to call your API endpoint with CORS enabled.

    This separation ensures clean deployments, independent scaling, and better isolation of build and runtime environments.

    For more information, refer to the official documentation: Quickstart: Deploy a Node.js web app to Azure

    Feel free to post back if you have any further questions.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.