Skip to content

Commit 90086f9

Browse files
committed
updates
1 parent 92f04a3 commit 90086f9

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

articles/app-service/configure-language-nodejs.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ az webapp config appsettings set --name <app-name> --resource-group <resource-gr
6464
> [!NOTE]
6565
> This example uses the recommended "tilde syntax" to target the latest available version of Node.js 16 runtime on App Service.
6666
>
67-
>Since the runtime is regularly patched and updated by the platform it's not recommended to target a specific minor version/patch as these are not guaranteed to be available due to potential security risks.
67+
>Since the runtime is regularly patched and updated by the platform, we don't recommend that you target a specific minor version/patch as these are not guaranteed to be available due to potential security risks.
6868
6969
> [!NOTE]
7070
> You should set the Node.js version in your project's `package.json`. The deployment engine runs in a separate process that contains all the supported Node.js versions.
@@ -92,13 +92,13 @@ Your Node.js app needs to listen to the right port to receive incoming requests.
9292

9393
::: zone pivot="platform-windows"
9494

95-
In App Service on Windows, Node.js apps are hosted with [IISNode](https://github.com/Azure/iisnode), and your Node.js app should listen to the port specified in the `process.env.PORT` variable. The following example shows how you do it in a simple Express app:
95+
In App Service on Windows, Node.js apps are hosted with [IISNode](https://github.com/Azure/iisnode), and your Node.js app should listen to the port specified in the `process.env.PORT` variable. The following example shows how to get the the port number of a simple Express app:
9696

9797
::: zone-end
9898

9999
::: zone pivot="platform-linux"
100100

101-
App Service sets the environment variable `PORT` in the Node.js container, and forwards the incoming requests to your container at that port number. To receive the requests, your app should listen to that port using `process.env.PORT`. The following example shows how you do it in a simple Express app:
101+
App Service sets the environment variable `PORT` in the Node.js container, and forwards the incoming requests to your container at that port number. To receive the requests, your app should listen to that port using `process.env.PORT`. The following example shows how to get the port numboer of a simple Express app:
102102

103103
::: zone-end
104104

@@ -163,7 +163,7 @@ The container automatically starts your app with PM2 when one of the common Node
163163
- *app.js*
164164
- *index.js*
165165
- *hostingstart.js*
166-
- One of the following [PM2 files](https://pm2.keymetrics.io/docs/usage/application-declaration/#process-file): *process.json* and *ecosystem.config.js*
166+
- One of the following [PM2 files](https://pm2.keymetrics.io/docs/usage/application-declaration/#process-file): *process.json* or *ecosystem.config.js*
167167

168168
You can also configure a custom start file with the following extensions:
169169

@@ -210,9 +210,6 @@ az webapp config set --resource-group <resource-group-name> --name <app-name> --
210210

211211
## Debug remotely
212212

213-
> [!NOTE]
214-
> Remote debugging is currently in Preview.
215-
216213
You can debug your Node.js app remotely in [Visual Studio Code](https://code.visualstudio.com/) if you configure it to [run with PM2](#run-with-pm2), except when you run it using a *.config.js,*.yml, or *.yaml*.
217214

218215
In most cases, no extra configuration is required for your app. If your app is run with a *process.json* file (default or custom), it must have a `script` property in the JSON root. For example:
@@ -227,9 +224,9 @@ In most cases, no extra configuration is required for your app. If your app is r
227224

228225
To set up Visual Studio Code for remote debugging, install the [App Service extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice). Follow the instructions on the extension page and sign in to Azure in Visual Studio Code.
229226

230-
In the Azure explorer, find the app you want to debug, right-click it and select **Start Remote Debugging**. Click **Yes** to enable it for your app. App Service starts a tunnel proxy for you and attaches the debugger. You can then make requests to the app and see the debugger pausing at break points.
227+
In the Azure explorer, find the app you want to debug, right-click it and select **Start Remote Debugging**. Select **Yes** to enable remote debugging for your app. App Service starts a tunnel proxy for you and attaches the debugger. You can then make requests to the app and see the debugger pausing at break points.
231228

232-
Once finished with debugging, stop the debugger by selecting **Disconnect**. When prompted, you should click **Yes** to disable remote debugging. To disable it later, right-click your app again in the Azure explorer and select **Disable Remote Debugging**.
229+
Once finished with debugging, stop the debugger by selecting **Disconnect**. When prompted, you should select **Yes** to disable remote debugging. To disable it later, right-click your app again in the Azure explorer and select **Disable Remote Debugging**.
233230

234231
::: zone-end
235232

@@ -243,7 +240,7 @@ process.env.NODE_ENV
243240

244241
## Run Grunt/Bower/Gulp
245242

246-
By default, App Service build automation runs `npm install --production` when it recognizes a Node.js app is deployed through Git, or through Zip deployment [with build automation enabled](deploy-zip.md#enable-build-automation-for-zip-deploy). If your app requires any of the popular automation tools, such as Grunt, Bower, or Gulp, you need to supply a [custom deployment script](https://github.com/projectkudu/kudu/wiki/Custom-Deployment-Script) to run it.
243+
By default, App Service build automation runs `npm install --production` when it recognizes that a Node.js app is deployed through Git, or through Zip deployment [with build automation enabled](deploy-zip.md#enable-build-automation-for-zip-deploy). If your app requires any of the popular automation tools, such as Grunt, Bower, or Gulp, you need to supply a [custom deployment script](https://github.com/projectkudu/kudu/wiki/Custom-Deployment-Script) to run it.
247244

248245
To enable your repository to run these tools, you need to add them to the dependencies in *package.json.* For example:
249246

@@ -256,7 +253,7 @@ To enable your repository to run these tools, you need to add them to the depend
256253
}
257254
```
258255

259-
From a local terminal window, change directory to your repository root and run the following commands:
256+
From a local terminal window, change the directory to your repository root and run the following commands:
260257

261258
```bash
262259
npm install kuduscript -g
@@ -322,7 +319,7 @@ fi
322319

323320
## Detect HTTPS session
324321

325-
In App Service, [TLS/SSL termination](https://wikipedia.org/wiki/TLS_termination_proxy) happens at the network load balancers, so all HTTPS requests reach your app as unencrypted HTTP requests. If your app logic needs to check if the user requests are encrypted or not, inspect the `X-Forwarded-Proto` header.
322+
In App Service, [TLS/SSL termination](https://wikipedia.org/wiki/TLS_termination_proxy) happens at the network load balancers, so all HTTPS requests reach your app as unencrypted HTTP requests. If your app logic needs to check if the user requests are encrypted, inspect the `X-Forwarded-Proto` header.
326323

327324
Popular web frameworks let you access the `X-Forwarded-*` information in your standard app pattern. In [Express](https://expressjs.com/), you can use [trust proxies](https://expressjs.com/guide/behind-proxies.html). For example:
328325

@@ -352,12 +349,12 @@ if (req.secure) {
352349

353350
## URL rewrites
354351

355-
When deploying Node.js apps on Azure App Service for Linux, you may need to handle URL rewrites directly within your application. This is particularly useful for ensuring specific URL patterns are redirected to the correct endpoints without relying on web server configurations. There are several ways to accomplish URL rewrites in Node.js. One example is through the [express-urlrewrite](https://www.npmjs.com/package/express-urlrewrite) package.
352+
When deploying Node.js apps on Azure App Service for Linux, you might need to handle URL rewrites directly within your application. This is particularly useful for ensuring specific URL patterns are redirected to the correct endpoints without relying on web server configurations. There are several ways to accomplish URL rewrites in Node.js. One example is through the [express-urlrewrite](https://www.npmjs.com/package/express-urlrewrite) package.
356353

357354

358355
## Monitor with Application Insights
359356

360-
Application Insights allows you to monitor your application's performance, exceptions, and usage without making any code changes. To attach the App Insights agent, go to your web app in the Portal and select **Application Insights** under **Settings**, then select **Turn on Application Insights**. Next, select an existing App Insights resource or create a new one. Finally, select **Apply** at the bottom. To instrument your web app using PowerShell, please see [these instructions](../azure-monitor/app/azure-web-apps-nodejs.md#enable-through-powershell)
357+
Application Insights allows you to monitor your application's performance, exceptions, and usage without making any code changes. To attach the Application Insights agent, go to your web app in the portal, select **Application Insights** under **Settings**, and then select **Turn on Application Insights**. Next, select an existing Application Insights resource or create a new one. Finally, select **Apply** at the bottom. To instrument your web app using PowerShell, see [these instructions](../azure-monitor/app/azure-web-apps-nodejs.md#enable-through-powershell).
361358

362359
This agent will monitor your server-side Node.js application. To monitor your client-side JavaScript, [add the JavaScript SDK to your project](../azure-monitor/app/javascript.md).
363360

@@ -371,16 +368,16 @@ When a working Node.js app behaves differently in App Service or has errors, try
371368

372369
- [Access the log stream](#access-diagnostic-logs).
373370
- Test the app locally in production mode. App Service runs your Node.js apps in production mode, so you need to make sure that your project works as expected in production mode locally. For example:
374-
- Depending on your *package.json*, different packages may be installed for production mode (`dependencies` vs. `devDependencies`).
375-
- Certain web frameworks may deploy static files differently in production mode.
376-
- Certain web frameworks may use custom startup scripts when running in production mode.
371+
- Depending on your *package.json*, different packages might be installed for production mode (`dependencies` vs. `devDependencies`).
372+
- Certain web frameworks might deploy static files differently in production mode.
373+
- Certain web frameworks might use custom startup scripts when running in production mode.
377374
- Run your app in App Service in development mode. For example, in [MEAN.js](https://meanjs.org/), you can set your app to development mode in runtime by [setting the `NODE_ENV` app setting](configure-common.md).
378375

379376
::: zone pivot="platform-windows"
380377

381378
#### You do not have permission to view this directory or page
382379

383-
After deploying your Node.js code to a native Windows app in App Service, you may see the message `You do not have permission to view this directory or page.` in the browser when navigating to your app's URL. This is most likely because you don't have a *web.config* file (see the [template](https://github.com/projectkudu/kudu/blob/master/Kudu.Core/Scripts/iisnode.config.template) and an [example](https://github.com/Azure-Samples/nodejs-docs-hello-world/blob/master/web.config)).
380+
After deploying your Node.js code to a native Windows app in App Service, you might see the message `You do not have permission to view this directory or page` in the browser when navigating to your app's URL. This is most likely because you don't have a *web.config* file. (See the [template](https://github.com/projectkudu/kudu/blob/master/Kudu.Core/Scripts/iisnode.config.template) and an [example](https://github.com/Azure-Samples/nodejs-docs-hello-world/blob/master/web.config).)
384381

385382
If you deploy your files by using Git, or by using ZIP deployment [with build automation enabled](deploy-zip.md#enable-build-automation-for-zip-deploy), the deployment engine generates a *web.config* in the web root of your app (`%HOME%\site\wwwroot`) automatically if one of the following conditions is true:
386383

@@ -389,7 +386,7 @@ If you deploy your files by using Git, or by using ZIP deployment [with build au
389386

390387
The generated *web.config* is tailored to the detected start script. For other deployment methods, add this *web.config* manually. Make sure the file is formatted properly.
391388

392-
If you use [ZIP deployment](deploy-zip.md) (through Visual Studio Code, for example), be sure to [enable build automation](deploy-zip.md#enable-build-automation-for-zip-deploy) because it's not enabled by default. [`az webapp up`](/cli/azure/webapp#az-webapp-up) uses ZIP deployment with build automation enabled.
389+
If you use [ZIP deployment](deploy-zip.md) (through Visual Studio Code, for example), be sure to [enable build automation](deploy-zip.md#enable-build-automation-for-zip-deploy). It's not enabled by default. [`az webapp up`](/cli/azure/webapp#az-webapp-up) uses ZIP deployment with build automation enabled.
393390

394391
::: zone-end
395392

@@ -407,7 +404,7 @@ If you use [ZIP deployment](deploy-zip.md) (through Visual Studio Code, for exam
407404
::: zone pivot="platform-linux"
408405

409406
> [!div class="nextstepaction"]
410-
> [App Service Linux FAQ](faq-app-service-linux.yml)
407+
> [Azure App Service on Linux FAQ](faq-app-service-linux.yml)
411408
412409
::: zone-end
413410

0 commit comments

Comments
 (0)