diff --git a/appengine/README.md b/appengine/README.md
index c634bc093a..b63051b1a0 100644
--- a/appengine/README.md
+++ b/appengine/README.md
@@ -1,7 +1,7 @@
# Google App Engine Node.js Samples
These are samples for using [Node.js][nodejs] on
-[Google App Engine Flexible Environment][appengine]. Many of these samples
+[Google App Engine][appengine]. Many of these samples
are referenced from the documentation on [cloud.google.com][appengine].
There are also samples [submitted by the community][community_samples].
@@ -57,17 +57,42 @@ The App Engine Node.js samples typically that you do the following:
## Deploying
-Some samples in this repositories may have special deployment instructions.
+Some samples may have special deployment instructions.
Refer to the `README.md` file in the sample folder.
+Many samples in this folder can be deployed to both App Engine Node.js standard
+environment and flexible environment. Those samples come with two different
+App Engine configuration files: `app.flexible.yaml` for flexible environment,
+and `app.standard.yaml` for standard environment.
+
+Samples with one single configuration file, `app.yaml`, can only be deployed
+to one of the two environments. See the `README.md` files for these samples
+for more information.
+
+Generally speaking, to deploy a sample application:
+
1. Use the [Google Cloud Console][console] to create a Google Cloud Platform
project.
1. [Enable billing][billing] for your project.
1. Use the Cloud SDK to deploy your app.
+ For samples with two configuration files (`app.flexible.yaml` and
+ `app.standard.yaml`), if you plan to use App Engine Node.js Standard
+ Environment, run
+
+ gcloud app deploy app.standard.yaml
+
+ To deploy to App Engine Node.js Flexible Environment, run
+
+ gcloud app deploy app.flexible.yaml
+
+ For samples with one configuration file (`app.yaml`), run
+
gcloud app deploy
+ to deploy the app to its compatible environment.
+
Note: If there is a `yarn.lock` file then `yarn install` will be used during
deployment. Delete the `yarn.lock` file to fall back to `npm install`.
@@ -82,7 +107,7 @@ View the [Official App Engine Node.js samples][official_samples].
View the [Community-contributed App Engine Node.js samples][community_samples].
[nodejs]: https://nodejs.org/
-[appengine]: https://cloud.google.com/appengine/docs/flexible/nodejs/
+[appengine]: https://cloud.google.com/appengine/
[nodejs_dev]: https://cloud.google.com/community/tutorials/how-to-prepare-a-nodejs-dev-environment
[sdk]: https://cloud.google.com/sdk/
[console]: https://console.cloud.google.com
diff --git a/appengine/analytics/README.md b/appengine/analytics/README.md
index 4771f93654..2afa56a3fd 100644
--- a/appengine/analytics/README.md
+++ b/appengine/analytics/README.md
@@ -1,8 +1,11 @@
# Integrating with Google Analytics
-This is the sample application for the
-[Integrating with Google Analytics tutorial][tutorial] tutorial found in the
-[Google App Engine Node.js Flexible Environment][appengine] documentation.
+This sample application shows how to integrate your Node.js application with
+Google Analytics on Google App Engine.
+
+[App Engine standard environment][appengine-std] users: See tutorial [Integrating with Google Analytics][std-tutorial] for more information on running and deploying this app.
+
+[App Engine flexible environment][appengine-flex] users: See tutorial [Integrating with Google Analytics][flex-tutorial] for more information on running and deploying this app.
* [Setup](#setup)
* [Running locally](#running-locally)
@@ -37,22 +40,27 @@ or with `yarn`:
GA_TRACKING_ID=YOUR_TRACKING_ID yarn start
-## Deploying to App Engine
+## Deploying to App Engine standard Environment
-With `npm`:
+```
+gcloud app deploy app.standard.yaml
+```
- npm run deploy
+## Deploying to App Engine flexible Environment
-or with `yarn`:
+```
+gcloud app deploy app.flexible.yaml
+```
- yarn run deploy
## Running the tests
See [Contributing][contributing].
-[appengine]: https://cloud.google.com/appengine/docs/flexible/nodejs
-[tutorial]: https://cloud.google.com/appengine/docs/flexible/nodejs/integrating-with-analytics
+[appengine-flex]: https://cloud.google.com/appengine/docs/flexible/nodejs
+[appengine-std]: https://cloud.google.com/appengine/docs/standard/nodejs
+[flex-tutorial]: https://cloud.google.com/appengine/docs/flexible/nodejs/integrating-with-analytics
+[std-tutorial]: https://cloud.google.com/appengine/docs/standard/nodejs/integrating-with-analytics
[readme]: ../README.md
[tracking]: https://support.google.com/analytics/answer/1042508
[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md
diff --git a/appengine/analytics/app.yaml b/appengine/analytics/app.flexible.yaml
similarity index 100%
rename from appengine/analytics/app.yaml
rename to appengine/analytics/app.flexible.yaml
diff --git a/appengine/analytics/app.standard.yaml b/appengine/analytics/app.standard.yaml
new file mode 100644
index 0000000000..5746c3569b
--- /dev/null
+++ b/appengine/analytics/app.standard.yaml
@@ -0,0 +1,21 @@
+# Copyright 2017, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+
+# [START env]
+env_variables:
+ GA_TRACKING_ID: YOUR_TRACKING_ID
+# [END env]
+# [END app_yaml]
diff --git a/appengine/analytics/package.json b/appengine/analytics/package.json
index dbdb07c17a..33a50fa0ae 100644
--- a/appengine/analytics/package.json
+++ b/appengine/analytics/package.json
@@ -1,6 +1,6 @@
{
"name": "appengine-analytics",
- "description": "Sample for Google Analytics Measurement Protocol on Google App Engine Flexible Environment.",
+ "description": "Sample for Google Analytics Measurement Protocol on Google App Engine.",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
@@ -10,16 +10,14 @@
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
- "node": ">=4"
+ "node": "8.x.x"
},
"scripts": {
- "deploy": "gcloud app deploy",
"start": "node app.js",
"lint": "repo-tools lint",
"pretest": "npm run lint",
"system-test": "repo-tools test app",
- "test": "npm run system-test",
- "e2e-test": "repo-tools test deploy"
+ "test": "npm run system-test"
},
"dependencies": {
"express": "4.16.2",
diff --git a/appengine/building-an-app/build/README.md b/appengine/building-an-app/build/README.md
new file mode 100644
index 0000000000..c5afa706fd
--- /dev/null
+++ b/appengine/building-an-app/build/README.md
@@ -0,0 +1,38 @@
+# Writing Your Web Service Sample for Node.js in the App Engine Standard Environment
+
+This is the sample application for the
+[Writing Your Web Service with Node.js][tutorial]
+tutorial found in the [Google App Engine Node.js standard environment][appengine]
+documentation.
+
+* [Setup](#setup)
+* [Running locally](#running-locally)
+* [Deploying to App Engine](#deploying-to-app-engine)
+* [Running the tests](#running-the-tests)
+
+## Setup
+
+Before you can run or deploy the sample, you need to do the following:
+
+1. Refer to the [appengine/README.md][readme] file for instructions on
+ running and deploying.
+1. Install dependencies:
+
+ npm install
+
+## Running locally
+
+ npm start
+
+## Deploying to App Engine
+
+ gcloud app deploy
+
+## Running the tests
+
+See [Contributing][contributing].
+
+[appengine]: https://cloud.google.com/appengine/docs/standard/nodejs
+[tutorial]: https://cloud.google.com/appengine/docs/standard/nodejs/building-app/writing-web-service
+[readme]: ../../README.md
+[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md
diff --git a/appengine/building-an-app/build/app.yaml b/appengine/building-an-app/build/app.yaml
new file mode 100755
index 0000000000..e938832ccb
--- /dev/null
+++ b/appengine/building-an-app/build/app.yaml
@@ -0,0 +1,16 @@
+# Copyright 2018, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+# [END app_yaml]
diff --git a/appengine/building-an-app/build/package.json b/appengine/building-an-app/build/package.json
new file mode 100755
index 0000000000..b79b11d691
--- /dev/null
+++ b/appengine/building-an-app/build/package.json
@@ -0,0 +1,43 @@
+{
+ "name": "appengine-standard-getting-started-build-apps",
+ "version": "0.0.1",
+ "description": "Node.js getting started sample for building an app on App Engine standard environment.",
+ "private": true,
+ "main": "server.js",
+ "scripts": {
+ "start": "node server.js",
+ "deploy": "gcloud app deploy",
+ "lint": "samples lint",
+ "pretest": "npm run lint",
+ "test": "samples test app"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
+ },
+ "engines": {
+ "node": "8.x.x"
+ },
+ "author": "Google Inc.",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "express": "^4.16.3"
+ },
+ "devDependencies": {
+ "@google-cloud/nodejs-repo-tools": "1.4.17",
+ "ava": "0.22.0",
+ "semistandard": "^12.0.1"
+ },
+ "cloud-repo-tools": {
+ "requiresKeyFile": false,
+ "requiresProjectId": false,
+ "test": {
+ "app": {
+ "args": [
+ "server.js"
+ ],
+ "msg": "Hello from App Engine!"
+ }
+ }
+ }
+}
diff --git a/appengine/building-an-app/build/server.js b/appengine/building-an-app/build/server.js
new file mode 100755
index 0000000000..a9918495c2
--- /dev/null
+++ b/appengine/building-an-app/build/server.js
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2018, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+// [START app]
+const express = require('express');
+const app = express();
+
+app.get('/', (req, res) => {
+ res.send('Hello from App Engine!');
+});
+
+// Listen to the App Engine-specified port, or 8080 otherwise
+const PORT = process.env.PORT || 8080;
+app.listen(PORT, () => {
+ console.log(`Server listening on port ${PORT}...`);
+});
+// [END app]
+
+module.exports = app;
diff --git a/appengine/building-an-app/update/README.md b/appengine/building-an-app/update/README.md
new file mode 100644
index 0000000000..63ee9d563b
--- /dev/null
+++ b/appengine/building-an-app/update/README.md
@@ -0,0 +1,38 @@
+# Updating Your Web Service Sample for Node.js in the App Engine Standard Environment
+
+This is the sample application for the
+[Updating Your Web Service][tutorial]
+tutorial found in the [Google App Engine Node.js standard environment][appengine]
+documentation.
+
+* [Setup](#setup)
+* [Running locally](#running-locally)
+* [Deploying to App Engine](#deploying-to-app-engine)
+* [Running the tests](#running-the-tests)
+
+## Setup
+
+Before you can run or deploy the sample, you need to do the following:
+
+1. Refer to the [appengine/README.md][readme] file for instructions on
+ running and deploying.
+1. Install dependencies:
+
+ npm install
+
+## Running locally
+
+ npm start
+
+## Deploying to App Engine
+
+ gcloud app deploy
+
+## Running the tests
+
+See [Contributing][contributing].
+
+[appengine]: https://cloud.google.com/appengine/docs/standard/nodejs
+[tutorial]: https://cloud.google.com/appengine/docs/standard/nodejs/building-app/updating-web-service
+[readme]: ../../README.md
+[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md
diff --git a/appengine/building-an-app/update/app.yaml b/appengine/building-an-app/update/app.yaml
new file mode 100755
index 0000000000..e938832ccb
--- /dev/null
+++ b/appengine/building-an-app/update/app.yaml
@@ -0,0 +1,16 @@
+# Copyright 2018, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+# [END app_yaml]
diff --git a/appengine/building-an-app/update/package.json b/appengine/building-an-app/update/package.json
new file mode 100755
index 0000000000..c7d0553074
--- /dev/null
+++ b/appengine/building-an-app/update/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "appengine-standard-getting-started-update-apps",
+ "version": "0.0.1",
+ "description": "Node.js getting started sample for updating an app on App Engine standard environment.",
+ "private": true,
+ "main": "server.js",
+ "scripts": {
+ "start": "node server.js",
+ "deploy": "gcloud app deploy",
+ "lint": "samples lint",
+ "pretest": "npm run lint",
+ "test": "ava --verbose test/*.test.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
+ },
+ "engines": {
+ "node": "8.x.x"
+ },
+ "author": "Google Inc.",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "body-parser": "^1.18.2",
+ "express": "^4.16.3",
+ "semistandard": "^12.0.1"
+ },
+ "devDependencies": {
+ "@google-cloud/nodejs-repo-tools": "1.4.17",
+ "ava": "0.22.0",
+ "semistandard": "^12.0.1"
+ }
+}
diff --git a/appengine/building-an-app/update/server.js b/appengine/building-an-app/update/server.js
new file mode 100755
index 0000000000..de0afd5a33
--- /dev/null
+++ b/appengine/building-an-app/update/server.js
@@ -0,0 +1,56 @@
+/**
+ * Copyright 2018, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+// [START app]
+const express = require('express');
+const bodyParser = require('body-parser');
+const path = require(`path`);
+
+const app = express();
+
+// [START enable_parser]
+app.use(bodyParser.urlencoded({ extended: true }));
+// [END enable_parser]
+
+app.get('/', (req, res) => {
+ res.send('Hello from App Engine!');
+});
+
+// [START add_display_form]
+app.get('/submit', (req, res) => {
+ res.sendFile(path.join(__dirname, '/views/form.html'));
+});
+// [END add_display_form]
+
+// [START add_post_handler]
+app.post('/submit', (req, res) => {
+ console.log({
+ name: req.body.name,
+ message: req.body.message
+ });
+ res.send('Thanks for your message!');
+});
+// [END add_post_handler]
+
+// Listen to the App Engine-specified port, or 8080 otherwise
+const PORT = process.env.PORT || 8080;
+app.listen(PORT, () => {
+ console.log(`Server listening on port ${PORT}...`);
+});
+// [END app]
+
+module.exports = app;
diff --git a/appengine/building-an-app/update/test/server.test.js b/appengine/building-an-app/update/test/server.test.js
new file mode 100755
index 0000000000..c624b4c4b6
--- /dev/null
+++ b/appengine/building-an-app/update/test/server.test.js
@@ -0,0 +1,59 @@
+// Copyright 2018, Google, Inc.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+'use strict';
+
+const path = require(`path`);
+const test = require(`ava`);
+const utils = require(`@google-cloud/nodejs-repo-tools`);
+
+const cwd = path.join(__dirname, `../`);
+const requestObj = utils.getRequest({
+ cwd: cwd,
+ cmd: `server` });
+
+test.beforeEach(utils.stubConsole);
+test.afterEach.always(utils.restoreConsole);
+
+test.cb.serial(`should send greetings`, (t) => {
+ requestObj
+ .get(`/`)
+ .expect(200)
+ .expect((response) => {
+ t.is(response.text, `Hello from App Engine!`);
+ })
+ .end(t.end);
+});
+
+test.cb.serial(`should display form`, (t) => {
+ requestObj
+ .get(`/submit`)
+ .expect(200)
+ .expect((response) => {
+ t.true(response.text.includes('textarea name="message" placeholder="Message"'));
+ })
+ .end(t.end);
+});
+
+test.cb.serial(`should record message`, (t) => {
+ requestObj
+ .post(`/submit`, {
+ name: `sample-user`,
+ message: `sample-message`
+ })
+ .expect(200)
+ .expect((response) => {
+ t.is(response.text, `Thanks for your message!`);
+ })
+ .end(t.end);
+});
diff --git a/appengine/building-an-app/update/views/form.html b/appengine/building-an-app/update/views/form.html
new file mode 100755
index 0000000000..ad738456a3
--- /dev/null
+++ b/appengine/building-an-app/update/views/form.html
@@ -0,0 +1,20 @@
+
+
+
+ My App Engine App
+
+
+
Create a new post
+
+
+
\ No newline at end of file
diff --git a/appengine/cloudsql/README.md b/appengine/cloudsql/README.md
index 3c5c14ed4b..ce3f598446 100644
--- a/appengine/cloudsql/README.md
+++ b/appengine/cloudsql/README.md
@@ -1,11 +1,15 @@
# Cloud SQL for MySQL Node.js sample on App Engine flexible environment
-This sample demonstrates how to use [Google Cloud SQL][sql] for
-[MySQL][mysql] on [Google App Engine Flexible][flexible].
+This sample application shows how to use [Google Cloud SQL[[sql] for [MySQL][mysql]
+on Google App Engine.
-To run the sample, see [the tutorial][tutorial].
+[App Engine standard environment][appengine-std] users: See tutorial [Using Cloud SQL for MySQL (App Engine Standard Environment)][std-tutorial] for more information on running and deploying this app.
+
+[App Engine flexible environment][appengine-flex] users: See tutorial [Using Cloud SQL for MySQL (App Engine Flexible Environment)][flex-tutorial] for more information on running and deploying this app.
[sql]: https://cloud.google.com/sql/
-[flexible]: https://cloud.google.com/appengine
[mysql]: https://www.mysql.com/downloads/
-[tutorial]: https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql
+[appengine-flex]: https://cloud.google.com/appengine/docs/flexible/nodejs
+[appengine-std]: https://cloud.google.com/appengine/docs/standard/nodejs
+[flex-tutorial]: https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql
+[std-tutorial]: https://cloud.google.com/appengine/docs/standard/nodejs/using-cloud-sql
diff --git a/appengine/cloudsql/app.yaml b/appengine/cloudsql/app.flexible.yaml
similarity index 88%
rename from appengine/cloudsql/app.yaml
rename to appengine/cloudsql/app.flexible.yaml
index b02543d6c2..dd69cea493 100644
--- a/appengine/cloudsql/app.yaml
+++ b/appengine/cloudsql/app.flexible.yaml
@@ -16,6 +16,8 @@ runtime: nodejs
env: flex
# [START env]
+# The following env variables may contain sensitive information that grants
+# anyone access to your database. Do not add this file to your source control.
env_variables:
SQL_USER: YOUR_SQL_USER
SQL_PASSWORD: YOUR_SQL_PASSWORD
diff --git a/appengine/cloudsql/app.standard.yaml b/appengine/cloudsql/app.standard.yaml
new file mode 100644
index 0000000000..5608bdc126
--- /dev/null
+++ b/appengine/cloudsql/app.standard.yaml
@@ -0,0 +1,35 @@
+# Copyright 2017, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+
+# [START env]
+# The following env variables may contain sensitive information that grants
+# anyone access to your database. Do not add this file to your source control.
+env_variables:
+ SQL_USER: YOUR_SQL_USER
+ SQL_PASSWORD: YOUR_SQL_PASSWORD
+ SQL_DATABASE: YOUR_SQL_DATABASE
+ # e.g. my-awesome-project:us-central1:my-cloud-sql-instance
+ INSTANCE_CONNECTION_NAME: YOUR_INSTANCE_CONNECTION_NAME
+# [END env]
+
+# [START cloudsql_settings]
+beta_settings:
+ # The connection name of your instance, available by using
+ # 'gcloud beta sql instances describe [INSTANCE_NAME]' or from
+ # the Instance details page in the Google Cloud Platform Console.
+ cloud_sql_instances: YOUR_INSTANCE_CONNECTION_NAME
+# [END cloudsql_settings]
+# [END app_yaml]
diff --git a/appengine/cloudsql/package.json b/appengine/cloudsql/package.json
index 674b83bfd9..f37f65a1a4 100644
--- a/appengine/cloudsql/package.json
+++ b/appengine/cloudsql/package.json
@@ -1,6 +1,6 @@
{
"name": "appengine-cloudsql-mysql",
- "description": "Node.js MySQL sample for Cloud SQL on App Engine flexible environment.",
+ "description": "Node.js MySQL sample for Cloud SQL on App Engine.",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
@@ -10,10 +10,9 @@
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"scripts": {
- "deploy": "gcloud app deploy",
"lint": "repo-tools lint",
"pretest": "npm run lint",
"unit-test": "ava --verbose test/*.test.js",
@@ -21,8 +20,7 @@
"system-test": "repo-tools test app -- server.js",
"system-test-proxy": "npm run start-proxy; npm run system-test",
"all-test": "npm run unit-test && npm run system-test",
- "test": "repo-tools test run --cmd npm -- run all-test",
- "e2e-test": "repo-tools test deploy"
+ "test": "repo-tools test run --cmd npm -- run all-test"
},
"dependencies": {
"async": "2.6.0",
diff --git a/appengine/cloudsql_postgresql/README.md b/appengine/cloudsql_postgresql/README.md
index e1981e39fa..9ca57720aa 100644
--- a/appengine/cloudsql_postgresql/README.md
+++ b/appengine/cloudsql_postgresql/README.md
@@ -1,11 +1,17 @@
-# Cloud SQL for Postgres Node.js sample on App Engine flexible environment
+# Cloud SQL for PostgreSQL Node.js sample on App Engine flexible environment
-This sample demonstrates how to use [Google Cloud SQL][sql] for
-[Postgres][postgres] on [Google App Engine Flexible][flexible].
+This sample application shows how to use [Google Cloud SQL[[sql] for [PostgreSQL][postgres]
+on Google App Engine.
-To run the sample, see [the tutorial][tutorial].
+[App Engine standard environment][appengine-std] users: See tutorial [
+Using Cloud SQL for PostgreSQL (App Engine Standard Environment)][std-tutorial] for more information on running and deploying this app.
+
+[App Engine flexible environment][appengine-flex] users: See tutorial [
+Using Cloud SQL for PostgreSQL (App Engine Flexible Environment)][flex-tutorial] for more information on running and deploying this app.
[sql]: https://cloud.google.com/sql/
-[flexible]: https://cloud.google.com/appengine
[postgres]: https://www.postgresql.org/download/
-[tutorial]: https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql-postgres
+[appengine-flex]: https://cloud.google.com/appengine/docs/flexible/nodejs
+[appengine-std]: https://cloud.google.com/appengine/docs/standard/nodejs
+[flex-tutorial]: https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql-postgres
+[std-tutorial]: https://cloud.google.com/appengine/docs/standard/nodejs/using-cloud-sql-postgres
diff --git a/appengine/cloudsql_postgresql/app.yaml b/appengine/cloudsql_postgresql/app.flexible.yaml
similarity index 88%
rename from appengine/cloudsql_postgresql/app.yaml
rename to appengine/cloudsql_postgresql/app.flexible.yaml
index b02543d6c2..dd69cea493 100644
--- a/appengine/cloudsql_postgresql/app.yaml
+++ b/appengine/cloudsql_postgresql/app.flexible.yaml
@@ -16,6 +16,8 @@ runtime: nodejs
env: flex
# [START env]
+# The following env variables may contain sensitive information that grants
+# anyone access to your database. Do not add this file to your source control.
env_variables:
SQL_USER: YOUR_SQL_USER
SQL_PASSWORD: YOUR_SQL_PASSWORD
diff --git a/appengine/cloudsql_postgresql/app.standard.yaml b/appengine/cloudsql_postgresql/app.standard.yaml
new file mode 100644
index 0000000000..5608bdc126
--- /dev/null
+++ b/appengine/cloudsql_postgresql/app.standard.yaml
@@ -0,0 +1,35 @@
+# Copyright 2017, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+
+# [START env]
+# The following env variables may contain sensitive information that grants
+# anyone access to your database. Do not add this file to your source control.
+env_variables:
+ SQL_USER: YOUR_SQL_USER
+ SQL_PASSWORD: YOUR_SQL_PASSWORD
+ SQL_DATABASE: YOUR_SQL_DATABASE
+ # e.g. my-awesome-project:us-central1:my-cloud-sql-instance
+ INSTANCE_CONNECTION_NAME: YOUR_INSTANCE_CONNECTION_NAME
+# [END env]
+
+# [START cloudsql_settings]
+beta_settings:
+ # The connection name of your instance, available by using
+ # 'gcloud beta sql instances describe [INSTANCE_NAME]' or from
+ # the Instance details page in the Google Cloud Platform Console.
+ cloud_sql_instances: YOUR_INSTANCE_CONNECTION_NAME
+# [END cloudsql_settings]
+# [END app_yaml]
diff --git a/appengine/cloudsql_postgresql/package.json b/appengine/cloudsql_postgresql/package.json
index e8a71a7c8d..6b147350e2 100644
--- a/appengine/cloudsql_postgresql/package.json
+++ b/appengine/cloudsql_postgresql/package.json
@@ -1,6 +1,6 @@
{
"name": "appengine-cloudsql-postgres",
- "description": "Node.js PostgreSQL sample for Cloud SQL on App Engine flexible environment.",
+ "description": "Node.js PostgreSQL sample for Cloud SQL on App Engine.",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
@@ -10,10 +10,9 @@
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"scripts": {
- "deploy": "gcloud app deploy",
"lint": "repo-tools lint",
"pretest": "npm run lint",
"unit-test": "ava --verbose test/*.test.js",
@@ -21,8 +20,7 @@
"system-test": "repo-tools test app -- server.js",
"system-test-proxy": "npm run start-proxy; npm run system-test",
"all-test": "npm run unit-test && npm run system-test",
- "test": "repo-tools test run --cmd npm -- run all-test",
- "e2e-test": "repo-tools test deploy"
+ "test": "repo-tools test run --cmd npm -- run all-test"
},
"dependencies": {
"async": "2.6.0",
diff --git a/appengine/cloudtasks/README.md b/appengine/cloudtasks/README.md
index ab2db06d66..74f476ba23 100644
--- a/appengine/cloudtasks/README.md
+++ b/appengine/cloudtasks/README.md
@@ -1,7 +1,7 @@
# Node.js Google Cloud Tasks sample for Google App Engine
-This sample demonstrates how to use [Google Cloud Tasks](https://cloud.google.com/cloud-tasks/)
-on [Google App Engine Flexible Environment](https://cloud.google.com/appengine/docs/flexible/nodejs).
+This sample application shows how to use [Google Cloud Tasks](https://cloud.google.com/cloud-tasks/)
+on Google App Engine Node.js [standard environment][appengine-std] and [flexible environment][appengine-flex].
App Engine queues push tasks to an App Engine HTTP target. This directory
contains both the App Engine app to deploy, as well as the snippets to run
@@ -13,7 +13,11 @@ the App Engine app.
`server.js` is the main App Engine app. This app serves as an endpoint to
receive App Engine task attempts.
-`app.yaml` configures the App Engine app.
+`app.standard.yaml` configures the app for App Engine Node.js standard
+environment.
+
+`app.flexible.yaml` configures the app for App Engine Node.js flexible
+environment.
* [Setup](#setup)
* [Running locally](#running-locally)
@@ -48,11 +52,27 @@ version unless configured to do otherwise. Read the online help for the
`create-app-engine-queue` or the `update-app-engine-queue` commands to learn
about routing overrides for App Engine queues.
-## Deploying the App Engine app
+## Deploying the app to App Engine standard environment
+
+Deploy the App Engine app with gcloud:
+
+ gcloud app deploy app.standard.yaml
+
+Verify the index page is serving:
+
+ gcloud app browse
+
+The App Engine app serves as a target for the push requests. It has an
+endpoint `/log_payload` that reads the payload (i.e., the request body) of the
+HTTP POST request and logs it. The log output can be viewed with:
+
+ gcloud app logs read
+
+## Deploying the app to App Engine flexible environment
Deploy the App Engine app with gcloud:
- gcloud app deploy
+ gcloud app deploy app.flexible.yaml
Verify the index page is serving:
@@ -85,3 +105,6 @@ Examples:
For more information, see https://cloud.google.com/cloud-tasks
```
+
+[appengine-flex]: https://cloud.google.com/appengine/docs/flexible/nodejs
+[appengine-std]: https://cloud.google.com/appengine/docs/standard/nodejs
diff --git a/appengine/cloudtasks/app.yaml b/appengine/cloudtasks/app.flexible.yaml
similarity index 100%
rename from appengine/cloudtasks/app.yaml
rename to appengine/cloudtasks/app.flexible.yaml
diff --git a/appengine/cloudtasks/app.standard.yaml b/appengine/cloudtasks/app.standard.yaml
new file mode 100644
index 0000000000..8f8f6fd97a
--- /dev/null
+++ b/appengine/cloudtasks/app.standard.yaml
@@ -0,0 +1,16 @@
+# Copyright 2017, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+# [END app_yaml]
diff --git a/appengine/cloudtasks/package.json b/appengine/cloudtasks/package.json
index aed2e91adf..294f44abd7 100644
--- a/appengine/cloudtasks/package.json
+++ b/appengine/cloudtasks/package.json
@@ -1,23 +1,21 @@
{
"name": "appengine-cloudtasks",
- "description": "Google App Engine Flexible Environment Cloud Tasks example.",
+ "description": "Google App Engine Standard Environment Cloud Tasks example.",
"version": "0.0.0",
"license": "Apache-2.0",
"author": "Google Inc.",
"private": true,
"repository": "GoogleCloudPlatform/nodejs-docs-samples",
"engines": {
- "node": ">=4.0.0"
+ "node": "8.x.x"
},
"scripts": {
- "deploy": "gcloud app deploy",
"lint": "repo-tools lint",
"pretest": "npm run lint",
"unit-test": "ava --verbose test/*.test.js",
"system-test": "repo-tools test app --config package.json --config-key cloud-repo-tools",
"all-test": "npm run unit-test && npm run system-test",
- "test": "repo-tools test run --cmd npm -- run all-test",
- "e2e-test": "repo-tools test deploy --config package.json --config-key cloud-repo-tools"
+ "test": "repo-tools test run --cmd npm -- run all-test"
},
"dependencies": {
"body-parser": "1.18.2",
diff --git a/appengine/datastore/README.md b/appengine/datastore/README.md
index 0efae30781..c775a53cdf 100644
--- a/appengine/datastore/README.md
+++ b/appengine/datastore/README.md
@@ -1,8 +1,11 @@
# Using Cloud Datastore
-This is the sample application for the
-[Using Cloud Datastore][tutorial] tutorial found in the
-[Google App Engine Node.js Flexible Environment][appengine] documentation.
+This sample application shows how to use Google Cloud Datastore on Google App
+Engine.
+
+[App Engine standard environment][appengine-std] users: See tutorial [Using Cloud Datastore][tutorial-std] for more information on running and deploying this app.
+
+[App Engine flexible environment][appengine-flex] users: See tutorial [Using Cloud Datastore][tutorial-flex] for more information on running and deploying this app.
* [Setup](#setup)
* [Running locally](#running-locally)
@@ -35,21 +38,21 @@ or with `yarn`:
yarn start
-## Deploying to App Engine
+## Deploying to App Engine standard environment
-With `npm`:
+ gcloud app deploy app.standard.yaml
- npm run deploy
-
-or with `yarn`:
+## Deploying to App Engine flexible environment
- yarn run deploy
+ gcloud app deploy app.flexible.yaml
## Running the tests
See [Contributing][contributing].
-[appengine]: https://cloud.google.com/appengine/docs/flexible/nodejs
-[tutorial]: https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-datastore
+[appengine-flex]: https://cloud.google.com/appengine/docs/flexible/nodejs
+[appengine-std]: https://cloud.google.com/appengine/docs/standard/nodejs
+[tutorial-std]: https://cloud.google.com/appengine/docs/standard/nodejs/using-cloud-datastore
+[tutorial-flex]: https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-datastore
[readme]: ../README.md
[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md
diff --git a/appengine/datastore/app.yaml b/appengine/datastore/app.flexible.yaml
similarity index 100%
rename from appengine/datastore/app.yaml
rename to appengine/datastore/app.flexible.yaml
diff --git a/appengine/datastore/app.standard.yaml b/appengine/datastore/app.standard.yaml
new file mode 100644
index 0000000000..8f8f6fd97a
--- /dev/null
+++ b/appengine/datastore/app.standard.yaml
@@ -0,0 +1,16 @@
+# Copyright 2017, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+# [END app_yaml]
diff --git a/appengine/datastore/package.json b/appengine/datastore/package.json
index effb513c1b..f9cc1f649f 100644
--- a/appengine/datastore/package.json
+++ b/appengine/datastore/package.json
@@ -1,6 +1,6 @@
{
"name": "appengine-datastore",
- "description": "Sample for Google Cloud Datastore on Google App Engine Flexible Environment.",
+ "description": "Sample for Google Cloud Datastore on Google App Engine.",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
@@ -10,16 +10,14 @@
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"scripts": {
- "deploy": "gcloud app deploy",
"start": "node app.js",
"lint": "repo-tools lint",
"pretest": "npm run lint",
"system-test": "repo-tools test app",
- "test": "npm run system-test",
- "e2e-test": "repo-tools test deploy"
+ "test": "npm run system-test"
},
"dependencies": {
"@google-cloud/datastore": "1.3.4",
diff --git a/appengine/endpoints/README.md b/appengine/endpoints/README.md
index 5d2355d5a1..14724e3271 100644
--- a/appengine/endpoints/README.md
+++ b/appengine/endpoints/README.md
@@ -1,6 +1,7 @@
-# Google Cloud Endpoints sample for Google App Engine Flexible Environment
+# Google Cloud Endpoints sample for Google App Engine flexible environment
-This sample demonstrates how to use Google Cloud Endpoints on Google App Engine Flexible Environment using Node.js.
+This sample demonstrates how to use Google Cloud Endpoints on Google App Engine
+flexible environment using Node.js.
## Running locally
diff --git a/appengine/errorreporting/README.md b/appengine/errorreporting/README.md
index f4b8f03a6c..ff850097dd 100644
--- a/appengine/errorreporting/README.md
+++ b/appengine/errorreporting/README.md
@@ -1,9 +1,12 @@
# Node.js error reporting sample for Google App Engine
-This sample demonstrates error reporting in a Node.js app for
-[Google App Engine Flexible Environment](https://cloud.google.com/appengine).
+This sample shows how to use Stackdriver Error Reporting on Google App Engine
+Node.js [standard environment][appengine-std] and [flexible environment][appengine-flex].
## Running locally
Refer to the [appengine/README.md](../README.md) file for instructions on
running and deploying.
+
+[appengine-flex]: https://cloud.google.com/appengine/docs/flexible/nodejs
+[appengine-std]: https://cloud.google.com/appengine/docs/standard/nodejs
\ No newline at end of file
diff --git a/appengine/errorreporting/app.yaml b/appengine/errorreporting/app.flexible.yaml
similarity index 100%
rename from appengine/errorreporting/app.yaml
rename to appengine/errorreporting/app.flexible.yaml
diff --git a/appengine/errorreporting/app.standard.yaml b/appengine/errorreporting/app.standard.yaml
new file mode 100644
index 0000000000..8cf0f07dc8
--- /dev/null
+++ b/appengine/errorreporting/app.standard.yaml
@@ -0,0 +1,16 @@
+# Copyright 2015-2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+# [END app_yaml]
diff --git a/appengine/errorreporting/package.json b/appengine/errorreporting/package.json
index d770a4264a..7344c7c3cb 100644
--- a/appengine/errorreporting/package.json
+++ b/appengine/errorreporting/package.json
@@ -1,6 +1,6 @@
{
"name": "appengine-error-reporting",
- "description": "Node.js error reporting sample for Google App Engine Flexible Environment.",
+ "description": "Node.js error reporting sample for Google App Engine.",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
@@ -10,17 +10,15 @@
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"scripts": {
- "deploy": "gcloud app deploy",
"start": "node app.js",
"lint": "repo-tools lint",
"pretest": "npm run lint",
"unit-test": "ava --verbose test/*.test.js",
"system-test": "repo-tools test app",
- "test": "npm run unit-test && npm run system-test",
- "e2e-test": "repo-tools test deploy"
+ "test": "npm run unit-test && npm run system-test"
},
"dependencies": {
"@google-cloud/error-reporting": "0.2.3",
diff --git a/appengine/hello-world/README.md b/appengine/hello-world/flexible/README.md
similarity index 82%
rename from appengine/hello-world/README.md
rename to appengine/hello-world/flexible/README.md
index eff3ee5949..585ccade53 100644
--- a/appengine/hello-world/README.md
+++ b/appengine/hello-world/flexible/README.md
@@ -1,8 +1,8 @@
-# Quickstart for Node.js in the App Engine Flexible Environment
+# Quickstart for Node.js in the App Engine flexible environment
This is the sample application for the
-[Quickstart for Node.js in the App Engine Flexible Environment][tutorial]
-tutorial found in the [Google App Engine Node.js Flexible Environment][appengine]
+[Quickstart for Node.js in the App Engine flexible environment][tutorial]
+tutorial found in the [Google App Engine Node.js flexible environment][appengine]
documentation.
* [Setup](#setup)
@@ -52,5 +52,5 @@ See [Contributing][contributing].
[appengine]: https://cloud.google.com/appengine/docs/flexible/nodejs
[tutorial]: https://cloud.google.com/appengine/docs/flexible/nodejs/quickstart
-[readme]: ../README.md
+[readme]: ../../README.md
[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md
diff --git a/appengine/hello-world/app.js b/appengine/hello-world/flexible/app.js
similarity index 100%
rename from appengine/hello-world/app.js
rename to appengine/hello-world/flexible/app.js
diff --git a/appengine/hello-world/app.yaml b/appengine/hello-world/flexible/app.yaml
similarity index 100%
rename from appengine/hello-world/app.yaml
rename to appengine/hello-world/flexible/app.yaml
diff --git a/appengine/hello-world/package.json b/appengine/hello-world/flexible/package.json
similarity index 100%
rename from appengine/hello-world/package.json
rename to appengine/hello-world/flexible/package.json
diff --git a/appengine/hello-world/standard/README.md b/appengine/hello-world/standard/README.md
new file mode 100644
index 0000000000..49a651de0e
--- /dev/null
+++ b/appengine/hello-world/standard/README.md
@@ -0,0 +1,56 @@
+# Quickstart for Node.js in the App Engine standard environment
+
+This is the sample application for the
+[Quickstart for Node.js in the App Engine standard environment][tutorial]
+tutorial found in the [Google App Engine Node.js standard environment][appengine]
+documentation.
+
+* [Setup](#setup)
+* [Running locally](#running-locally)
+* [Deploying to App Engine](#deploying-to-app-engine)
+* [Running the tests](#running-the-tests)
+
+## Setup
+
+Before you can run or deploy the sample, you need to do the following:
+
+1. Refer to the [appengine/README.md][readme] file for instructions on
+ running and deploying.
+1. Install dependencies:
+
+ With `npm`:
+
+ npm install
+
+ or with `yarn`:
+
+ yarn install
+
+## Running locally
+
+With `npm`:
+
+ npm start
+
+or with `yarn`:
+
+ yarn start
+
+## Deploying to App Engine
+
+With `npm`:
+
+ npm run deploy
+
+or with `yarn`:
+
+ yarn run deploy
+
+## Running the tests
+
+See [Contributing][contributing].
+
+[appengine]: https://cloud.google.com/appengine/docs/standard/nodejs
+[tutorial]: https://cloud.google.com/appengine/docs/standard/nodejs/quickstart
+[readme]: ../../README.md
+[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md
diff --git a/appengine/hello-world/standard/app.js b/appengine/hello-world/standard/app.js
new file mode 100644
index 0000000000..be1e3735bc
--- /dev/null
+++ b/appengine/hello-world/standard/app.js
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2017, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+// [START app]
+const express = require('express');
+
+const app = express();
+
+app.get('/', (req, res) => {
+ res.status(200).send('Hello, world!').end();
+});
+
+// Start the server
+const PORT = process.env.PORT || 8080;
+app.listen(PORT, () => {
+ console.log(`App listening on port ${PORT}`);
+ console.log('Press Ctrl+C to quit.');
+});
+// [END app]
diff --git a/appengine/hello-world/standard/app.yaml b/appengine/hello-world/standard/app.yaml
new file mode 100644
index 0000000000..8f8f6fd97a
--- /dev/null
+++ b/appengine/hello-world/standard/app.yaml
@@ -0,0 +1,16 @@
+# Copyright 2017, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+# [END app_yaml]
diff --git a/appengine/hello-world/standard/package.json b/appengine/hello-world/standard/package.json
new file mode 100644
index 0000000000..f4a3a3efc8
--- /dev/null
+++ b/appengine/hello-world/standard/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "appengine-hello-world",
+ "description": "Simple Hello World Node.js sample for Google App Engine Standard Environment.",
+ "version": "0.0.1",
+ "private": true,
+ "license": "Apache-2.0",
+ "author": "Google Inc.",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
+ },
+ "engines": {
+ "node": "8.x.x"
+ },
+ "scripts": {
+ "deploy": "gcloud app deploy",
+ "start": "node app.js",
+ "lint": "samples lint",
+ "pretest": "npm run lint",
+ "system-test": "samples test app",
+ "test": "npm run system-test",
+ "e2e-test": "samples test deploy"
+ },
+ "dependencies": {
+ "express": "4.16.2"
+ },
+ "devDependencies": {
+ "@google-cloud/nodejs-repo-tools": "2.2.1"
+ },
+ "cloud-repo-tools": {
+ "test": {
+ "app": {
+ "msg": "Hello, world!"
+ }
+ },
+ "requiresKeyFile": true,
+ "requiresProjectId": true
+ }
+}
diff --git a/appengine/loopback/README.md b/appengine/loopback/README.md
index e80d7fb9e3..c8ec714155 100644
--- a/appengine/loopback/README.md
+++ b/appengine/loopback/README.md
@@ -2,12 +2,17 @@
> [Loopback][1] is a highly-extensible, open-source Node.js framework.
-Read the [Loopback.js on App Engine Tutorial][2] for how to run and deploy this
+Refer to the [appengine/README.md](../README.md) file for more instructions on
+running and deploying this app.
+
+[App Engine flexible environment][5] users may also read the community
+tutorial [Loopback.js on App Engine Tutorial][2] for how to run and deploy this
sample app.
-You can also view the [live demo][3] and read the [Loopback.js documentation][4].
+Additionally, view the [live demo][3] and read the [Loopback.js documentation][4].
[1]: http://loopback.io/
[2]: https://cloud.google.com/nodejs/resources/frameworks/loopback
[3]: http://loopback-dot-nodejs-docs-samples.appspot.com
[4]: http://loopback.io/getting-started/
+[5]: https://cloud.google.com/appengine/docs/flexible/nodejs
diff --git a/appengine/loopback/app.yaml b/appengine/loopback/app.flexible.yaml
similarity index 100%
rename from appengine/loopback/app.yaml
rename to appengine/loopback/app.flexible.yaml
diff --git a/appengine/loopback/app.standard.yaml b/appengine/loopback/app.standard.yaml
new file mode 100644
index 0000000000..8cf0f07dc8
--- /dev/null
+++ b/appengine/loopback/app.standard.yaml
@@ -0,0 +1,16 @@
+# Copyright 2015-2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+# [END app_yaml]
diff --git a/appengine/loopback/package.json b/appengine/loopback/package.json
index a60f02dab2..1315a5a643 100644
--- a/appengine/loopback/package.json
+++ b/appengine/loopback/package.json
@@ -6,7 +6,7 @@
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"main": "server/server.js",
"scripts": {
diff --git a/appengine/mailjet/README.md b/appengine/mailjet/README.md
index be4567a852..38e1183f06 100644
--- a/appengine/mailjet/README.md
+++ b/appengine/mailjet/README.md
@@ -5,12 +5,15 @@
> – www.mailjet.com
This sample application demonstrates how to use [Express.js][2] and
-[node-mailjet][3] to send transactional email on [Google App Engine][4].
+[node-mailjet][3] to send transactional email on [Google App Engine][4] Node.js
+[standard environment][5] and [flexible environment][6].
-You can also read the [Mailjet documentation][5].
+You can also read the [Mailjet documentation][7].
[1]: https://www.mailjet.com/
[2]: http://expressjs.com
[3]: https://github.com/mailjet/mailjet-apiv3-nodejs
[4]: https://cloud.google.com/appengine
-[5]: https://dev.mailjet.com/
+[5]: https://cloud.google.com/appengine/docs/standard/nodejs
+[6]: https://cloud.google.com/appengine/docs/flexible/nodejs
+[7]: https://dev.mailjet.com/
diff --git a/appengine/mailjet/app.flexible.yaml b/appengine/mailjet/app.flexible.yaml
new file mode 100644
index 0000000000..b0e77702c2
--- /dev/null
+++ b/appengine/mailjet/app.flexible.yaml
@@ -0,0 +1,24 @@
+# Copyright 2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs
+env: flex
+
+# The following env variables may contain sensitive information that grants
+# anyone access to your Mailjet account. Do not add this file to your source
+# control.
+env_variables:
+ MJ_APIKEY_PUBLIC:
+ MJ_APIKEY_PRIVATE:
+# [END app_yaml]
diff --git a/appengine/mailjet/app.js b/appengine/mailjet/app.js
index bbe352501c..6082f19e98 100644
--- a/appengine/mailjet/app.js
+++ b/appengine/mailjet/app.js
@@ -1,5 +1,5 @@
/**
- * Copyright 2016, Google, Inc.
+ * Copyright 2018, Google, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -60,14 +60,14 @@ app.post('/hello', function (req, res, next) {
var request = Mailjet.post('send').request(options);
request
- .on('success', function (response, body) {
+ .then(function (response, body) {
console.log(response.statusCode, body);
// Render the index route on success
return res.render('index', {
sent: true
});
})
- .on('error', function (err) {
+ .catch(function (err) {
return next(err);
});
});
diff --git a/appengine/mailjet/app.standard.yaml b/appengine/mailjet/app.standard.yaml
new file mode 100644
index 0000000000..4c7e57e5b4
--- /dev/null
+++ b/appengine/mailjet/app.standard.yaml
@@ -0,0 +1,23 @@
+# Copyright 2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+
+# The following env variables may contain sensitive information that grants
+# anyone access to your Mailjet account. Do not add this file to your source
+# control.
+env_variables:
+ MJ_APIKEY_PUBLIC:
+ MJ_APIKEY_PRIVATE:
+# [END app_yaml]
diff --git a/appengine/mailjet/package.json b/appengine/mailjet/package.json
index ebe8dddb7c..a090038fa4 100644
--- a/appengine/mailjet/package.json
+++ b/appengine/mailjet/package.json
@@ -1,6 +1,6 @@
{
"name": "appengine-mailjet",
- "description": "An example of using Mailjet in Node.js on Google App Engine Flexible Environment.",
+ "description": "An example of using Mailjet in Node.js on Google App Engine.",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
@@ -10,16 +10,14 @@
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"scripts": {
- "deploy": "gcloud app deploy",
"start": "node app.js",
"lint": "repo-tools lint",
"pretest": "npm run lint",
"system-test": "repo-tools test app",
- "test": "npm run system-test",
- "e2e-test": "repo-tools test deploy"
+ "test": "npm run system-test"
},
"dependencies": {
"body-parser": "1.18.2",
diff --git a/appengine/memcached/README.md b/appengine/memcached/README.md
index b719581ed9..5aec146d19 100644
--- a/appengine/memcached/README.md
+++ b/appengine/memcached/README.md
@@ -1,9 +1,13 @@
# Memcached sample for Google App Engine
This sample demonstrates accessing Memcached from Node.js on
-[Google App Engine Flexible Environment](https://cloud.google.com/appengine).
+[Google App Engine](https://cloud.google.com/appengine) Node.js [standard
+environment][appengine-std] and [flexible environment][appengine-flex].
## Running locally
Refer to the [appengine/README.md](../README.md) file for instructions on
running and deploying.
+
+[appengine-flex]: https://cloud.google.com/appengine/docs/flexible/nodejs
+[appengine-std]: https://cloud.google.com/appengine/docs/standard/nodejs
diff --git a/appengine/memcached/app.yaml b/appengine/memcached/app.flexible.yaml
similarity index 87%
rename from appengine/memcached/app.yaml
rename to appengine/memcached/app.flexible.yaml
index 9e53787477..c470d7db25 100644
--- a/appengine/memcached/app.yaml
+++ b/appengine/memcached/app.flexible.yaml
@@ -16,6 +16,9 @@ runtime: nodejs
env: flex
# [START env_variables]
+# The following env variables may contain sensitive information that grants
+# anyone access to your memcached service. Do not add this file to your source
+# control.
env_variables:
# If you are using the App Engine Memcache service (currently in alpha),
# uncomment this section and comment out the other Memcache variables.
diff --git a/appengine/memcached/app.standard.yaml b/appengine/memcached/app.standard.yaml
new file mode 100644
index 0000000000..71944f14e3
--- /dev/null
+++ b/appengine/memcached/app.standard.yaml
@@ -0,0 +1,33 @@
+# Copyright 2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+
+# [START env_variables]
+# The following env variables may contain sensitive information that grants
+# anyone access to your memcached service. Do not add this file to your source
+# control.
+env_variables:
+ # If you are using the App Engine Memcache service,
+ # uncomment this section and comment out the other Memcache variables.
+ #USE_GAE_MEMCACHE: 1
+ #GAE_MEMCACHE_HOST: 35.190.255.1
+ #GAE_MEMCACHE_PORT: 11211
+ MEMCACHE_URL: your-memcache-url
+ # If you are using a Memcached server with SASL authentiation enabled,
+ # fill in these values with your username and password.
+ MEMCACHE_USERNAME: your-memcache-username
+ MEMCACHE_PASSWORD: your-memcache-password
+# [END env_variables]
+# [END app_yaml]
diff --git a/appengine/memcached/package.json b/appengine/memcached/package.json
index 2d39a0c67c..56bc2d6976 100644
--- a/appengine/memcached/package.json
+++ b/appengine/memcached/package.json
@@ -1,12 +1,12 @@
{
"name": "appengine-memcached",
- "description": "Memcached sample for Google App Engine Flexible Environment",
+ "description": "Memcached sample for Google App Engine.",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"scripts": {
"start": "node app.js"
diff --git a/appengine/mailjet/app.yaml b/appengine/metadata/flexible/app.yaml
similarity index 83%
rename from appengine/mailjet/app.yaml
rename to appengine/metadata/flexible/app.yaml
index 5e74170900..690f318f28 100644
--- a/appengine/mailjet/app.yaml
+++ b/appengine/metadata/flexible/app.yaml
@@ -14,7 +14,4 @@
# [START app_yaml]
runtime: nodejs
env: flex
-env_variables:
- MJ_APIKEY_PUBLIC:
- MJ_APIKEY_PRIVATE:
-# [END app_yaml]
+# [END app_yaml]
\ No newline at end of file
diff --git a/appengine/metadata/package.json b/appengine/metadata/flexible/package.json
similarity index 88%
rename from appengine/metadata/package.json
rename to appengine/metadata/flexible/package.json
index 7f6292498f..e375120dc6 100644
--- a/appengine/metadata/package.json
+++ b/appengine/metadata/flexible/package.json
@@ -1,6 +1,6 @@
{
"name": "appengine-metadata",
- "description": "Sample for accessing the Compute metadata server on GAE.",
+ "description": "Sample for accessing the Compute metadata server on GAE Flexible Environment.",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
@@ -10,14 +10,13 @@
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
- "node": ">=4"
+ "node": "8.x.x"
},
"scripts": {
"lint": "repo-tools lint",
"pretest": "npm run lint",
"system-test": "repo-tools test app -- server.js",
- "test": "npm run system-test",
- "e2e-test": "repo-tools test deploy"
+ "test": "npm run system-test"
},
"dependencies": {
"express": "4.16.2",
diff --git a/appengine/metadata/server.js b/appengine/metadata/flexible/server.js
similarity index 100%
rename from appengine/metadata/server.js
rename to appengine/metadata/flexible/server.js
diff --git a/appengine/metadata/standard/app.yaml b/appengine/metadata/standard/app.yaml
new file mode 100644
index 0000000000..25df3f3dff
--- /dev/null
+++ b/appengine/metadata/standard/app.yaml
@@ -0,0 +1,16 @@
+# Copyright 2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+# [END app_yaml]
\ No newline at end of file
diff --git a/appengine/metadata/standard/package.json b/appengine/metadata/standard/package.json
new file mode 100644
index 0000000000..79e55be338
--- /dev/null
+++ b/appengine/metadata/standard/package.json
@@ -0,0 +1,40 @@
+{
+ "name": "appengine-metadata",
+ "description": "Sample for accessing the Compute metadata server on GAE Standard Environment.",
+ "version": "0.0.1",
+ "private": true,
+ "license": "Apache-2.0",
+ "author": "Google Inc.",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
+ },
+ "engines": {
+ "node": "8.x.x"
+ },
+ "scripts": {
+ "lint": "samples lint",
+ "pretest": "npm run lint",
+ "system-test": "samples test app",
+ "test": "npm run system-test"
+ },
+ "dependencies": {
+ "express": "4.16.2",
+ "got": "8.2.0"
+ },
+ "devDependencies": {
+ "@google-cloud/nodejs-repo-tools": "2.2.1"
+ },
+ "cloud-repo-tools": {
+ "test": {
+ "app": {
+ "msg": "External IP:",
+ "args": [
+ "server.js"
+ ]
+ }
+ },
+ "requiresKeyFile": false,
+ "requiresProjectId": false
+ }
+}
diff --git a/appengine/metadata/standard/server.js b/appengine/metadata/standard/server.js
new file mode 100644
index 0000000000..7ea0a849e0
--- /dev/null
+++ b/appengine/metadata/standard/server.js
@@ -0,0 +1,59 @@
+/**
+ * Copyright 2017, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+// [START appengine_metadata]
+const express = require('express');
+const request = require('got');
+
+const app = express();
+app.enable('trust proxy');
+
+const METADATA_NETWORK_INTERFACE_URL = 'http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip';
+
+function getExternalIp () {
+ const options = {
+ headers: {
+ 'Metadata-Flavor': 'Google'
+ },
+ json: true
+ };
+
+ return request(METADATA_NETWORK_INTERFACE_URL, options)
+ .then((response) => response.body)
+ .catch((err) => {
+ if (err && err.statusCode !== 200) {
+ console.log('Error while talking to metadata server, assuming localhost');
+ return 'localhost';
+ }
+ return Promise.reject(err);
+ });
+}
+
+app.get('/', (req, res, next) => {
+ getExternalIp()
+ .then((externalIp) => {
+ res.status(200).send(`External IP: ${externalIp}`).end();
+ })
+ .catch(next);
+});
+
+const PORT = process.env.PORT || 8080;
+app.listen(PORT, () => {
+ console.log(`App listening on port ${PORT}`);
+ console.log('Press Ctrl+C to quit.');
+});
+// [END appengine_metadata]
diff --git a/appengine/mongodb/README.md b/appengine/mongodb/README.md
index add8b5a83f..b66d3c1463 100644
--- a/appengine/mongodb/README.md
+++ b/appengine/mongodb/README.md
@@ -2,11 +2,16 @@
> [MongoDB][1] is an open source (AGPL licensed), NoSQL document database.
-Read the [MongoDB on App Engine Tutorial][2] for how to run and deploy this sample
-app.
+Refer to the [appengine/README.md](../README.md) file for more instructions on
+running and deploying this app.
-You can also read the [node_mongodb documentation][3].
+[App Engine Node.js flexible environment][2] users may also read the community
+tutorial [MongoDB on App Engine Tutorial][3] for how to run and deploy this
+sample app.
+
+For more information about MongoDB Node.js Driver, read the [node_mongodb documentation][4].
[1]: http://mongodb.org/
-[2]: https://cloud.google.com/nodejs/resources/databases/mongodb
-[3]: http://mongodb.github.io/node-mongodb-native/
+[2]: https://cloud.google.com/appengine/docs/flexible/nodejs
+[3]: https://cloud.google.com/nodejs/resources/databases/mongodb
+[4]: http://mongodb.github.io/node-mongodb-native/
diff --git a/appengine/mongodb/app.yaml b/appengine/mongodb/app.flexible.yaml
similarity index 100%
rename from appengine/mongodb/app.yaml
rename to appengine/mongodb/app.flexible.yaml
diff --git a/appengine/mongodb/app.standard.yaml b/appengine/mongodb/app.standard.yaml
new file mode 100644
index 0000000000..8cf0f07dc8
--- /dev/null
+++ b/appengine/mongodb/app.standard.yaml
@@ -0,0 +1,16 @@
+# Copyright 2015-2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+# [END app_yaml]
diff --git a/appengine/mongodb/package.json b/appengine/mongodb/package.json
index f744b22114..98203e6ebd 100644
--- a/appengine/mongodb/package.json
+++ b/appengine/mongodb/package.json
@@ -6,7 +6,7 @@
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"scripts": {
"start": "node server.js",
diff --git a/appengine/parse-server/README.md b/appengine/parse-server/README.md
index d9b932792e..93bb4279be 100644
--- a/appengine/parse-server/README.md
+++ b/appengine/parse-server/README.md
@@ -1,7 +1,9 @@
# Parse-server sample for Google App Engine
-This sample demonstrates deploying a [Parse-server](https://github.com/ParsePlatform/parse-server)
-app to [Google App Engine Flexible Environment](https://cloud.google.com/appengine).
+This sample shows how to deploy a [Parse-server](https://github.com/ParsePlatform/parse-server)
+app to [Google App Engine](https://cloud.google.com/appengine) Node.js [standard
+environment](https://cloud.google.com/appengine/docs/standard/nodejs)
+and [flexible environment](https://cloud.google.com/appengine/docs/flexible/nodejs).
## Setup
@@ -23,10 +25,15 @@ app to [Google App Engine Flexible Environment](https://cloud.google.com/appengi
1. Set the necessary [environment variables](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/parse-server/config.json).
1. `npm start`
-## Deploy
+## Deploy to App Engine standard environment
1. Set the necessary [environment variables](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/parse-server/config.json).
-1. `npm run deploy`
+1. `gcloud app deploy app.standard.yaml`
+
+## Deploy to App Engine flexible environment
+
+1. Set the necessary [environment variables](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/parse-server/config.json).
+1. `gcloud app deploy app.flexible.yaml`
Refer to the [appengine/README.md](../README.md) file for more instructions on
running and deploying.
diff --git a/appengine/parse-server/app.yaml b/appengine/parse-server/app.flexible.yaml
similarity index 100%
rename from appengine/parse-server/app.yaml
rename to appengine/parse-server/app.flexible.yaml
diff --git a/appengine/parse-server/app.standard.yaml b/appengine/parse-server/app.standard.yaml
new file mode 100644
index 0000000000..ab74945fd7
--- /dev/null
+++ b/appengine/parse-server/app.standard.yaml
@@ -0,0 +1,16 @@
+# Copyright 2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+# [END app_yaml]
diff --git a/appengine/parse-server/package.json b/appengine/parse-server/package.json
index cf34810301..21f8fd9646 100644
--- a/appengine/parse-server/package.json
+++ b/appengine/parse-server/package.json
@@ -6,7 +6,7 @@
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"dependencies": {
"express": "4.16.2",
diff --git a/appengine/pubsub/README.md b/appengine/pubsub/README.md
index fdb0e035ce..1fa95d2077 100644
--- a/appengine/pubsub/README.md
+++ b/appengine/pubsub/README.md
@@ -1,6 +1,8 @@
# Node.js Cloud Pub/Sub sample for Google App Engine
-This demonstrates how to send and receive messages using [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) on [Google App Engine Flexible Environment](https://cloud.google.com/appengine) using Node.js.
+This sample shows how to send and receive messages using [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) on [Google App Engine](https://cloud.google.com/appengine)
+[standard environment](https://cloud.google.com/appengine/docs/standard/nodejs)
+and [flexible environment](https://cloud.google.com/appengine/docs/flexible/nodejs).
## Setup
diff --git a/appengine/pubsub/app.yaml b/appengine/pubsub/app.flexible.yaml
similarity index 100%
rename from appengine/pubsub/app.yaml
rename to appengine/pubsub/app.flexible.yaml
diff --git a/appengine/pubsub/app.standard.yaml b/appengine/pubsub/app.standard.yaml
new file mode 100644
index 0000000000..b21f713f64
--- /dev/null
+++ b/appengine/pubsub/app.standard.yaml
@@ -0,0 +1,28 @@
+# Copyright 2015-2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+
+# [START instance_class]
+instance_class: F2
+# [END instance_class]
+
+# [START env]
+env_variables:
+ PUBSUB_TOPIC: YOUR_TOPIC_NAME
+ # This token is used to verify that requests originate from your
+ # application. It can be any sufficiently random string.
+ PUBSUB_VERIFICATION_TOKEN: YOUR_VERIFICATION_TOKEN
+# [END env]
+# [END app_yaml]
diff --git a/appengine/pubsub/package.json b/appengine/pubsub/package.json
index 95e266cfa4..96068c0afe 100644
--- a/appengine/pubsub/package.json
+++ b/appengine/pubsub/package.json
@@ -6,7 +6,7 @@
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"scripts": {
"start": "node app.js",
diff --git a/appengine/redis/README.md b/appengine/redis/README.md
index 16d73d6c08..81231b23ed 100644
--- a/appengine/redis/README.md
+++ b/appengine/redis/README.md
@@ -3,11 +3,16 @@
> [Redis][1] is an open source (BSD licensed), in-memory data structure store,
used as database, cache and message broker.
-Read the [Redis on App Engine Tutorial][2] for how to run and deploy this sample
+Refer to the [appengine/README.md](../README.md) file for more instructions on
+running and deploying this app.
+
+[App Engine Node.js flexible environment][2] users may also read the community
+tutorial [Redis on App Engine Tutorial][3] for how to run and deploy this sample
app.
-You can also read the [node_redis documentation][3].
+Additionally, you can also read the [node_redis documentation][4].
[1]: http://redis.io/
-[2]: https://cloud.google.com/nodejs/resources/databases/redis
-[3]: https://github.com/NodeRedis/node_redis
+[2]: https://cloud.google.com/appengine/docs/flexible/nodejs
+[3]: https://cloud.google.com/nodejs/resources/databases/redis
+[4]: https://github.com/NodeRedis/node_redis
diff --git a/appengine/redis/app.yaml b/appengine/redis/app.flexible.yaml
similarity index 100%
rename from appengine/redis/app.yaml
rename to appengine/redis/app.flexible.yaml
diff --git a/appengine/redis/app.standard.yaml b/appengine/redis/app.standard.yaml
new file mode 100644
index 0000000000..8cf0f07dc8
--- /dev/null
+++ b/appengine/redis/app.standard.yaml
@@ -0,0 +1,16 @@
+# Copyright 2015-2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+# [END app_yaml]
diff --git a/appengine/redis/package.json b/appengine/redis/package.json
index 1b35c7ee20..902a5449cc 100644
--- a/appengine/redis/package.json
+++ b/appengine/redis/package.json
@@ -6,7 +6,7 @@
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"scripts": {
"start": "node server.js",
diff --git a/appengine/restify/README.md b/appengine/restify/README.md
index 9ee0cc4dc1..f51a5a7e48 100644
--- a/appengine/restify/README.md
+++ b/appengine/restify/README.md
@@ -1,2 +1 @@
-This has moved to [EDIT ON GITHUB REPORT ISSUE PAGE HISTORY
-Run Restify.js on Google App Engine Flexible Environment](https://cloud.google.com/community/tutorials/run-restifyjs-on-google-app-engine).
+This has moved to [Run Restify.js on Google App Engine Flexible Environment](https://cloud.google.com/community/tutorials/run-restifyjs-on-google-app-engine).
diff --git a/appengine/sendgrid/README.md b/appengine/sendgrid/README.md
index 0f2e3b1f75..89fcdd7e15 100644
--- a/appengine/sendgrid/README.md
+++ b/appengine/sendgrid/README.md
@@ -1,13 +1,15 @@
# Node.js SendGrid email sample for Google App Engine
-This sample demonstrates how to use [SendGrid](https://www.sendgrid.com) on
-[Google App Engine Flexible Environment](https://cloud.google.com/appengine).
+This sample application shows how to use [SendGrid](https://www.sendgrid.com) on
+[Google App Engine](https://cloud.google.com/appengine) Node.js [standard environment](https://cloud.google.com/appengine/docs/standard/nodejs)
+and [flexible environment](https://cloud.google.com/appengine/docs/flexible/nodejs).
For more information about SendGrid, see their
[documentation](https://sendgrid.com/docs/User_Guide/index.html).
-Read the [Sendgrid on App Engine Tutorial][5] for how to run and deploy this
-sample app.
+App Engine Node.js Flexible Environment users may also read the community
+tutorial [Sendgrid on App Engine Tutorial][1] for more information on how to
+run and deploy this sample app.
## Setup
@@ -16,7 +18,8 @@ Before you can run or deploy the sample, you will need to do the following:
1. [Create a SendGrid Account](http://sendgrid.com/partner/google). As of
September 2015, Google users start with 25,000 free emails per month.
1. Configure your SendGrid settings in the environment variables section in
-`app.yaml`.
+`app.standard.yaml` (if you are deploying to App Engine standard environment) or
+`app.flexible.yaml` (if you are deploying to App Engine flexible environment).
## Running locally
diff --git a/appengine/sendgrid/app.yaml b/appengine/sendgrid/app.flexible.yaml
similarity index 82%
rename from appengine/sendgrid/app.yaml
rename to appengine/sendgrid/app.flexible.yaml
index 8582bd77d5..79b79795bb 100644
--- a/appengine/sendgrid/app.yaml
+++ b/appengine/sendgrid/app.flexible.yaml
@@ -16,6 +16,9 @@ runtime: nodejs
env: flex
# [START env_variables]
+# The following env variables may contain sensitive information that grants
+# anyone access to your Sendgrid account. Do not add this file to your source
+# control.
env_variables:
SENDGRID_API_KEY:
SENDGRID_SENDER:
diff --git a/appengine/sendgrid/app.js b/appengine/sendgrid/app.js
index 0d48223e10..3eb5753fcf 100644
--- a/appengine/sendgrid/app.js
+++ b/appengine/sendgrid/app.js
@@ -21,7 +21,8 @@ const path = require('path');
const bodyParser = require('body-parser');
// [START setup]
-// The following environment variables are set by app.yaml when running on GAE,
+// The following environment variables are set by app.yaml (app.flexible.yaml or
+// app.standard.yaml) when running on Google App Engine,
// but will need to be manually set when running locally.
const SENDGRID_API_KEY = process.env.SENDGRID_API_KEY;
const SENDGRID_SENDER = process.env.SENDGRID_SENDER;
diff --git a/appengine/sendgrid/app.standard.yaml b/appengine/sendgrid/app.standard.yaml
new file mode 100644
index 0000000000..6feded5bf8
--- /dev/null
+++ b/appengine/sendgrid/app.standard.yaml
@@ -0,0 +1,25 @@
+# Copyright 2015-2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+
+# [START env_variables]
+# The following env variables may contain sensitive information that grants
+# anyone access to your Sendgrid account. Do not add this file to your source
+# control.
+env_variables:
+ SENDGRID_API_KEY:
+ SENDGRID_SENDER:
+# [END env_variables]
+# [END app_yaml]
diff --git a/appengine/sendgrid/package.json b/appengine/sendgrid/package.json
index 177962b681..d7a18fcc38 100644
--- a/appengine/sendgrid/package.json
+++ b/appengine/sendgrid/package.json
@@ -6,7 +6,7 @@
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"scripts": {
"start": "node app.js"
diff --git a/appengine/static-files/README.md b/appengine/static-files/README.md
index 05b23425b5..a76dad39ce 100644
--- a/appengine/static-files/README.md
+++ b/appengine/static-files/README.md
@@ -1,6 +1,7 @@
# Serving static files in Node.js sample for Google App Engine
-This sample demonstrates serving static files in a Node.js app for [Google App Engine Flexible Environment](https://cloud.google.com/appengine).
+This sample demonstrates serving static files in a Node.js app for [Google App Engine](https://cloud.google.com/appengine) Node.js [standard environment](https://cloud.google.com/appengine/docs/standard/nodejs)
+and [flexible environment](https://cloud.google.com/appengine/docs/flexible/nodejs)
## Running locally
diff --git a/appengine/static-files/app.yaml b/appengine/static-files/app.flexible.yaml
similarity index 100%
rename from appengine/static-files/app.yaml
rename to appengine/static-files/app.flexible.yaml
diff --git a/appengine/static-files/app.standard.yaml b/appengine/static-files/app.standard.yaml
new file mode 100644
index 0000000000..8cf0f07dc8
--- /dev/null
+++ b/appengine/static-files/app.standard.yaml
@@ -0,0 +1,16 @@
+# Copyright 2015-2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+# [END app_yaml]
diff --git a/appengine/static-files/package.json b/appengine/static-files/package.json
index dfd7b95eac..9a30d61824 100644
--- a/appengine/static-files/package.json
+++ b/appengine/static-files/package.json
@@ -6,7 +6,7 @@
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"scripts": {
"start": "node app.js",
diff --git a/appengine/storage/README.md b/appengine/storage/flexible/README.md
similarity index 89%
rename from appengine/storage/README.md
rename to appengine/storage/flexible/README.md
index cc9012bd42..de65b02ee3 100644
--- a/appengine/storage/README.md
+++ b/appengine/storage/flexible/README.md
@@ -1,7 +1,7 @@
# Node.js Google Cloud Storage sample for Google App Engine
This sample demonstrates how to use [Google Cloud Storage](https://cloud.google.com/storage/)
-on [Google App Engine Flexible Environment](https://cloud.google.com/appengine).
+on [Google App Engine flexible environment](https://cloud.google.com/appengine).
## Setup
@@ -24,7 +24,7 @@ with the following command:
## Running locally
-Refer to the [top-level README](../README.md) for instructions on running and
+Refer to the [top-level README](../../README.md) for instructions on running and
deploying.
When running locally, you can use the [Google Cloud SDK](https://cloud.google.com/sdk)
diff --git a/appengine/storage/app.js b/appengine/storage/flexible/app.js
similarity index 100%
rename from appengine/storage/app.js
rename to appengine/storage/flexible/app.js
diff --git a/appengine/storage/app.yaml b/appengine/storage/flexible/app.yaml
similarity index 100%
rename from appengine/storage/app.yaml
rename to appengine/storage/flexible/app.yaml
diff --git a/appengine/storage/package.json b/appengine/storage/flexible/package.json
similarity index 100%
rename from appengine/storage/package.json
rename to appengine/storage/flexible/package.json
diff --git a/appengine/storage/system-test/app.test.js b/appengine/storage/flexible/system-test/app.test.js
similarity index 100%
rename from appengine/storage/system-test/app.test.js
rename to appengine/storage/flexible/system-test/app.test.js
diff --git a/appengine/storage/system-test/resources/test.txt b/appengine/storage/flexible/system-test/resources/test.txt
similarity index 100%
rename from appengine/storage/system-test/resources/test.txt
rename to appengine/storage/flexible/system-test/resources/test.txt
diff --git a/appengine/storage/views/form.pug b/appengine/storage/flexible/views/form.pug
similarity index 100%
rename from appengine/storage/views/form.pug
rename to appengine/storage/flexible/views/form.pug
diff --git a/appengine/storage/standard/README.md b/appengine/storage/standard/README.md
new file mode 100644
index 0000000000..317a118453
--- /dev/null
+++ b/appengine/storage/standard/README.md
@@ -0,0 +1,40 @@
+# Node.js Google Cloud Storage sample for Google App Engine
+
+This sample demonstrates how to use [Google Cloud Storage](https://cloud.google.com/storage/)
+on [Google App Engine standard environment](https://cloud.google.com/appengine).
+
+## Setup
+
+Before you can run or deploy the sample, you will need to do the following:
+
+1. Enable the Cloud Storage API in the [Google Developers Console](https://console.developers.google.com/project/_/apiui/apiview/storage/overview).
+
+1. Create a Cloud Storage Bucket. You can do this with the [Google Cloud SDK](https://cloud.google.com/sdk)
+with the following command:
+
+ gsutil mb gs://
+
+1. Set the default ACL on your bucket to public read in order to serve files
+directly from Cloud Storage. You can do this with the [Google Cloud SDK](https://cloud.google.com/sdk)
+with the following command:
+
+ gsutil defacl set public-read gs://
+
+1. Update the environment variables in `app.yaml`.
+
+## Running locally
+
+Refer to the [top-level README](../../README.md) for instructions on running and
+deploying.
+
+When running locally, you can use the [Google Cloud SDK](https://cloud.google.com/sdk)
+to provide authentication to use Google Cloud APIs:
+
+ gcloud init
+
+Then set environment variables before starting your application:
+
+ export GOOGLE_CLOUD_PROJECT=
+ export GCLOUD_STORAGE_BUCKET=
+ npm install
+ npm start
diff --git a/appengine/storage/standard/app.js b/appengine/storage/standard/app.js
new file mode 100644
index 0000000000..71cdc51d28
--- /dev/null
+++ b/appengine/storage/standard/app.js
@@ -0,0 +1,96 @@
+/**
+ * Copyright 2016, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+const process = require('process'); // Required to mock environment variables
+
+// [START app]
+const format = require('util').format;
+const express = require('express');
+const Multer = require('multer');
+const bodyParser = require('body-parser');
+
+// By default, the client will authenticate using the service account file
+// specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable and use
+// the project specified by the GOOGLE_CLOUD_PROJECT environment variable. See
+// https://github.com/GoogleCloudPlatform/google-cloud-node/blob/master/docs/authentication.md
+// These environment variables are set automatically on Google App Engine
+const Storage = require('@google-cloud/storage');
+
+// Instantiate a storage client
+const storage = Storage();
+
+const app = express();
+app.set('view engine', 'pug');
+app.use(bodyParser.json());
+
+// [START config]
+// Multer is required to process file uploads and make them available via
+// req.files.
+const multer = Multer({
+ storage: Multer.memoryStorage(),
+ limits: {
+ fileSize: 5 * 1024 * 1024 // no larger than 5mb, you can change as needed.
+ }
+});
+
+// A bucket is a container for objects (files).
+const bucket = storage.bucket(process.env.GCLOUD_STORAGE_BUCKET);
+// [END config]
+
+// [START form]
+// Display a form for uploading files.
+app.get('/', (req, res) => {
+ res.render('form.pug');
+});
+// [END form]
+
+// [START process]
+// Process the file upload and upload to Google Cloud Storage.
+app.post('/upload', multer.single('file'), (req, res, next) => {
+ if (!req.file) {
+ res.status(400).send('No file uploaded.');
+ return;
+ }
+
+ // Create a new blob in the bucket and upload the file data.
+ const blob = bucket.file(req.file.originalname);
+ const blobStream = blob.createWriteStream({
+ resumable: false
+ });
+
+ blobStream.on('error', (err) => {
+ next(err);
+ });
+
+ blobStream.on('finish', () => {
+ // The public URL can be used to directly access the file via HTTP.
+ const publicUrl = format(`https://storage.googleapis.com/${bucket.name}/${blob.name}`);
+ res.status(200).send(publicUrl);
+ });
+
+ blobStream.end(req.file.buffer);
+});
+// [END process]
+
+const PORT = process.env.PORT || 8080;
+app.listen(PORT, () => {
+ console.log(`App listening on port ${PORT}`);
+ console.log('Press Ctrl+C to quit.');
+});
+// [END app]
+
+module.exports = app;
diff --git a/appengine/storage/standard/app.yaml b/appengine/storage/standard/app.yaml
new file mode 100644
index 0000000000..420e663d1f
--- /dev/null
+++ b/appengine/storage/standard/app.yaml
@@ -0,0 +1,21 @@
+# Copyright 2015-2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+
+# [START env]
+env_variables:
+ GCLOUD_STORAGE_BUCKET: YOUR_BUCKET_NAME
+# [END env]
+# [END app_yaml]
diff --git a/appengine/storage/standard/package.json b/appengine/storage/standard/package.json
new file mode 100644
index 0000000000..0106d6c427
--- /dev/null
+++ b/appengine/storage/standard/package.json
@@ -0,0 +1,40 @@
+{
+ "name": "appengine-storage",
+ "description": "Node.js Google Cloud Storage sample for Google App Engine",
+ "scripts": {
+ "start": "node app.js",
+ "test": "ava system-test/*.test.js -T 30s"
+ },
+ "engines": {
+ "node": "8.x.x"
+ },
+ "dependencies": {
+ "@google-cloud/storage": "1.6.0",
+ "body-parser": "1.18.2",
+ "express": "4.16.3",
+ "multer": "1.3.0",
+ "pug": "2.0.3"
+ },
+ "devDependencies": {
+ "@google-cloud/nodejs-repo-tools": "2.2.5",
+ "ava": "0.25.0"
+ },
+ "cloud-repo-tools": {
+ "requiresProjectId": true,
+ "requiresKeyFile": true,
+ "test": {
+ "app": {
+ "requiredEnvVars": [
+ "GCLOUD_STORAGE_BUCKET"
+ ],
+ "msg": "",
+ "substitutions": "YOUR_BUCKET_NAME=$GCLOUD_STORAGE_BUCKET"
+ },
+ "build": {
+ "requiredEnvVars": [
+ "GCLOUD_STORAGE_BUCKET"
+ ]
+ }
+ }
+ }
+}
diff --git a/appengine/storage/standard/system-test/app.test.js b/appengine/storage/standard/system-test/app.test.js
new file mode 100644
index 0000000000..f6750408b7
--- /dev/null
+++ b/appengine/storage/standard/system-test/app.test.js
@@ -0,0 +1,62 @@
+// Copyright 2017, Google, Inc.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+'use strict';
+
+const path = require(`path`);
+const Storage = require(`@google-cloud/storage`);
+const storage = Storage();
+const test = require(`ava`);
+const utils = require(`@google-cloud/nodejs-repo-tools`);
+
+const bucketName = process.env.GCLOUD_STORAGE_BUCKET;
+const bucket = storage.bucket(bucketName);
+
+const cwd = path.join(__dirname, `../`);
+const requestObj = utils.getRequest({ cwd: cwd });
+
+test.before(async () => {
+ utils.checkCredentials();
+ await bucket.create(bucket).then((data) => {
+ return bucket.acl.add({
+ entity: 'allUsers',
+ role: Storage.acl.READER_ROLE
+ });
+ });
+});
+test.after.always(async () => {
+ try {
+ await bucket.delete();
+ } catch (err) {} // ignore error
+});
+
+test.cb.serial(`should load`, (t) => {
+ requestObj
+ .get(`/`)
+ .expect(200)
+ .expect((response) => {
+ t.regex(response.text, //);
+ })
+ .end(t.end);
+});
+
+test.cb.serial(`should upload a file`, (t) => {
+ requestObj
+ .post(`/upload`)
+ .attach(`file`, path.join(__dirname, `resources/test.txt`))
+ .expect(200)
+ .expect((response) => {
+ t.is(response.text, `https://storage.googleapis.com/${bucketName}/test.txt`);
+ })
+ .end(t.end);
+});
diff --git a/appengine/storage/standard/system-test/resources/test.txt b/appengine/storage/standard/system-test/resources/test.txt
new file mode 100644
index 0000000000..3dcff04919
--- /dev/null
+++ b/appengine/storage/standard/system-test/resources/test.txt
@@ -0,0 +1 @@
+nodejs-docs-samples/appengine/storage test file
\ No newline at end of file
diff --git a/appengine/storage/standard/views/form.pug b/appengine/storage/standard/views/form.pug
new file mode 100644
index 0000000000..1089129a82
--- /dev/null
+++ b/appengine/storage/standard/views/form.pug
@@ -0,0 +1,10 @@
+doctype html
+html(lang="en")
+ head
+ title Static Files
+ meta(charset='utf-8')
+ link(rel="stylesheet", href="/static/main.css")
+ body
+ form(method="POST", action="/upload", enctype="multipart/form-data")
+ input(type="file", name="file")
+ input(type="submit")
diff --git a/appengine/system-test/all.test.js b/appengine/system-test/all.test.js
index 146252bf9a..1c20b36257 100644
--- a/appengine/system-test/all.test.js
+++ b/appengine/system-test/all.test.js
@@ -77,7 +77,16 @@ var sampleTests = [
msg: 'This is a static file serving example.'
},
{
- dir: 'appengine/storage',
+ dir: 'appengine/storage/flexible',
+ cmd: 'node',
+ args: ['app.js'],
+ msg: 'Static Files',
+ env: {
+ GCLOUD_STORAGE_BUCKET: 'nodejs-docs-samples'
+ }
+ },
+ {
+ dir: 'appengine/storage/standard',
cmd: 'node',
args: ['app.js'],
msg: 'Static Files',
diff --git a/appengine/twilio/README.md b/appengine/twilio/README.md
index 69e1dbf9fa..40bdb371e2 100644
--- a/appengine/twilio/README.md
+++ b/appengine/twilio/README.md
@@ -1,7 +1,8 @@
# Node.js Twilio voice and SMS sample for Google App Engine
-This sample demonstrates how to use [Twilio](https://www.twilio.com) on
-[Google App Engine Flexible Environment](https://cloud.google.com/appengine).
+This sample shows how to use [Twilio](https://www.twilio.com) on
+[Google App Engine](https://cloud.google.com/appengine) Node.js [standard environment](https://cloud.google.com/appengine/docs/standard/nodejs)
+and [flexible environment](https://cloud.google.com/appengine/docs/flexible/nodejs)
For more information about Twilio, see the
[Twilio Node library](https://www.twilio.com/docs/node/install).
diff --git a/appengine/twilio/app.yaml b/appengine/twilio/app.flexible.yaml
similarity index 83%
rename from appengine/twilio/app.yaml
rename to appengine/twilio/app.flexible.yaml
index 4de44bd625..a981d75ddd 100644
--- a/appengine/twilio/app.yaml
+++ b/appengine/twilio/app.flexible.yaml
@@ -16,6 +16,9 @@ runtime: nodejs
env: flex
# [START env_variables]
+# The following env variables may contain sensitive information that grants
+# anyone access to your Twilio account. Do not add this file to your source
+# control.
env_variables:
TWILIO_ACCOUNT_SID:
TWILIO_AUTH_TOKEN:
diff --git a/appengine/twilio/app.standard.yaml b/appengine/twilio/app.standard.yaml
new file mode 100644
index 0000000000..85fe77ab80
--- /dev/null
+++ b/appengine/twilio/app.standard.yaml
@@ -0,0 +1,26 @@
+# Copyright 2015-2016, Google, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START app_yaml]
+runtime: nodejs8
+
+# [START env_variables]
+# The following env variables may contain sensitive information that grants
+# anyone access to your Twilio account. Do not add this file to your source
+# control.
+env_variables:
+ TWILIO_ACCOUNT_SID:
+ TWILIO_AUTH_TOKEN:
+ TWILIO_NUMBER:
+# [END env_variables]
+# [END app_yaml]
diff --git a/appengine/twilio/package.json b/appengine/twilio/package.json
index 271aee75c8..efdb6aeb93 100644
--- a/appengine/twilio/package.json
+++ b/appengine/twilio/package.json
@@ -1,12 +1,12 @@
{
"name": "appengine-twilio",
- "description": "Samples for Google App Engine Flexible Environment",
+ "description": "Twilio sample for Google App Engine",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
- "node": ">=4.3.2"
+ "node": "8.x.x"
},
"scripts": {
"start": "node app.js"