You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Node.js apps must be deployed with all the required NPM dependencies. The App Service deployment engine automatically runs `npm install --production` for you when you deploy a [Git repository](deploy-local-git.md), or a [Zip package](deploy-zip.md)[with build automation enabled](deploy-zip.md#enable-build-automation-for-zip-deploy). If you deploy your files using [FTP/S](deploy-ftp.md), however, you need to upload the required packages manually.
16
+
Node.js apps must be deployed with all the required NPM dependencies. The App Service deployment engine automatically runs `npm install --production` for you when you deploy a [Git repository](deploy-local-git.md), or when you deploy a [Zip package](deploy-zip.md)[with build automation enabled](deploy-zip.md#enable-build-automation-for-zip-deploy). If you deploy your files using [FTP/S](deploy-ftp.md), however, you need to upload the required packages manually.
17
17
18
18
This guide provides key concepts and instructions for Node.js developers who deploy to App Service. If you've never used Azure App Service, follow the [Node.js quickstart](quickstart-nodejs.md) and [Node.js with MongoDB tutorial](tutorial-nodejs-mongodb-app.md) first.
19
19
@@ -120,7 +120,7 @@ app.listen(port, () => {
120
120
121
121
## Customize build automation
122
122
123
-
If you deploy your app using Git, or zip packages [with build automation enabled](deploy-zip.md#enable-build-automation-for-zip-deploy), the App Service build automation steps through the following sequence:
123
+
If you deploy your app by using Git, or by using zip packages [with build automation enabled](deploy-zip.md#enable-build-automation-for-zip-deploy), the App Service build automation steps through the following sequence:
124
124
125
125
1. Run custom script if specified by `PRE_BUILD_SCRIPT_PATH`.
126
126
1. Run `npm install` without any flags, which includes npm `preinstall` and `postinstall` scripts and also installs `devDependencies`.
@@ -129,7 +129,7 @@ If you deploy your app using Git, or zip packages [with build automation enabled
129
129
1. Run custom script if specified by `POST_BUILD_SCRIPT_PATH`.
130
130
131
131
> [!NOTE]
132
-
> As described in[npm docs](https://docs.npmjs.com/misc/scripts), scripts named `prebuild` and `postbuild` run before and after `build`, respectively, if specified. `preinstall` and `postinstall` run before and after `install`, respectively.
132
+
> As is noted in the[npm docs](https://docs.npmjs.com/misc/scripts), scripts named `prebuild` and `postbuild` run before and after `build`, respectively, if specified. `preinstall` and `postinstall` run before and after `install`, respectively.
133
133
134
134
`PRE_BUILD_COMMAND` and `POST_BUILD_COMMAND` are environment variables that are empty by default. To run pre-build commands, define `PRE_BUILD_COMMAND`. To run post-build commands, define `POST_BUILD_COMMAND`.
135
135
@@ -140,19 +140,19 @@ az webapp config appsettings set --name <app-name> --resource-group <resource-gr
140
140
az webapp config appsettings set --name <app-name> --resource-group <resource-group-name> --settings POST_BUILD_COMMAND="echo foo, scripts/postbuild.sh"
141
141
```
142
142
143
-
For additional environment variables to customize build automation, see [Oryx configuration](https://github.com/microsoft/Oryx/blob/master/doc/configuration.md).
143
+
For information about additional environment variables to customize build automation, see [Oryx configuration](https://github.com/microsoft/Oryx/blob/master/doc/configuration.md).
144
144
145
145
For more information on how App Service runs and builds Node.js apps in Linux, see [Oryx documentation: How Node.js apps are detected and built](https://github.com/microsoft/Oryx/blob/master/doc/runtimes/nodejs.md).
146
146
147
147
## Configure Node.js server
148
148
149
-
The Node.js containers come with [PM2](https://pm2.keymetrics.io/), a production process manager. You can configure your app to start with PM2, or with NPM, or with a custom command.
149
+
The Node.js containers come with [PM2](https://pm2.keymetrics.io/), a production process manager. You can configure your app to start with PM2, with npm start, or with a custom command.
150
150
151
151
|Tool|Purpose|
152
152
|--|--|
153
153
|[Run with PM2](#run-with-pm2)|**Recommended** - Production or staging use. PM2 provides a full-service app management platform.|
154
-
|[Run npm start](#run-npm-start)|Development use only.|
155
-
|[Run custom command](#run-custom-command)|Either development or staging.|
154
+
|[Run with npm start](#run-with-npm-start)|Development use only.|
155
+
|[Run with a custom command](#run-with-a-custom-command)|Either development or staging.|
156
156
157
157
### Run with PM2
158
158
@@ -179,15 +179,15 @@ To add a custom start file, run the following command in the [Cloud Shell](https
179
179
az webapp config set --resource-group <resource-group-name> --name <app-name> --startup-file "<filename-with-extension>"
180
180
```
181
181
182
-
### Run custom command
182
+
### Run with a custom command
183
183
184
184
App Service can start your app using a custom command, such as an executable like *run.sh*. For example, to run `npm run start:prod`, run the following command in the [Cloud Shell](https://shell.azure.com):
185
185
186
186
```azurecli-interactive
187
187
az webapp config set --resource-group <resource-group-name> --name <app-name> --startup-file "npm run start:prod"
188
188
```
189
189
190
-
### Run npm start
190
+
### Run with npm start
191
191
192
192
To start your app using `npm start`, just make sure a `start` script is in the *package.json* file. For example:
193
193
@@ -321,7 +321,7 @@ fi
321
321
322
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.
323
323
324
-
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:
324
+
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/en/guide/behind-proxies.html). For example:
0 commit comments