While running, it provides messages about creating the resource group, the App Service plan, and the app resource, configuring logging, and doing ZIP deployment. The command may take a few minutes to complete. If you see the error, "Could not auto-detect the runtime stack of your app," ensure you're running the command in the myExpressApp directory (See Troubleshooting auto-detect issues with az webapp up).To create a Windows app instead, use the -os-type argument. The command creates a Linux app for Node.js by default.You can retrieve a list of allowable regions for your Azure account by running the az account list-locations command. You can optionally include the argument -location where is an available Azure region.The -sku F1 argument creates the web app on the Free pricing tier, which incurs a no cost.
A good pattern is to use a combination of your company name and an app identifier.
NODEJS WINDOWS CODE
While Visual Studio Code provisions the Azure resources and deploys the code, it shows progress notifications. This way, as long as you're in the same workspace, Visual Studio Code deploys to the same App Service app each time. In the popup Always deploy the workspace "myExpressApp" to ", select Yes. In Select a pricing tier, select Free (F1) and wait for the resources to be provisioned in Azure. In Select a runtime stack, select the Node.js version you want. The name must be unique across all of Azure and use only alphanumeric characters ('A-Z', 'a-z', and '0-9') and hyphens ('-'). Type a globally unique name for your web app and press Enter. This service can be automatically started when the server restarts.Right-click on App Services and select Create new Web App.
NODEJS WINDOWS INSTALL
Luckily there is a NPM package node-windows which can install a node application as a Windows service. Every time the server restarted, the internal API was down and had to be manually started. Unfortunately I did not find a reliable way to start PM2 whenever the Windows Server restarts. PM2 can manage the node process and keep it up and running. We need an alternative to keep the node process running to make the internal API available on the server via localhost. In this case, we can't rely on IIS to manage the node process for us as IIS would expose the web application to the internet. The internal API is only consumed by other applications running on the same server. I have built an internal API in the past which should not be accessible from the outside for security reasons. In some cases however we don't want to expose the node.js web application via IIS. When it receives a request it will start the node process and pass the web request for node to handle it. With the help of the HTTP platform handler, IIS manages the node process for us. In the last article a node web application was deployed on a Windows server. Using HTTP platform handler to host a node.js application via IIS.Hosting a Node.js application on Windows with IIS as reverse proxy.These are the previous articles on the topic:
NODEJS WINDOWS HOW TO
It wasn't my intention when I started the first article but this has become a series of how to run node applications in production with IIS on Windows.