Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge samples for Flex and Std #590

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions appengine/analytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
This sample application shows how to integrate your Node.js application with
Google Analytics on Google App Engine.

App Engine Node.js Standard Environment users: See tutorial [Integrating with Google Analytics][std-tutorial] for more information on running and deploying this app.
[App Engine Standard][appengine-std] users: See tutorial [Integrating with Google Analytics][std-tutorial] for more information on running and deploying this app.

App Engine Node.js Flexible Environment users: See tutorial [Integrating with Google Analytics][flex-tutorial] for more information on running and deploying this app.
[App Engine Flexible][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)
Expand Down Expand Up @@ -42,11 +42,15 @@ or with `yarn`:

## Deploying to App Engine Standard Environment

gcloud app deploy app.standard.yaml
```
gcloud app deploy app.standard.yaml
```

## Deploying to App Engine Flexible Environment

gcloud app deploy app.flexible.yaml
```
gcloud app deploy app.flexible.yaml
```


## Running the tests
Expand Down
2 changes: 1 addition & 1 deletion appengine/building-an-app/build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Before you can run or deploy the sample, you need to do the following:

## Deploying to App Engine

npm run deploy
gcloud app deploy

## Running the tests

Expand Down
2 changes: 2 additions & 0 deletions appengine/building-an-app/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"private": true,
"main": "server.js",
"scripts": {
"start": "node server.js",
"deploy": "gcloud app deploy",
"lint": "samples lint",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In README.md, you specify start and deploy scripts. Make sure to add those (and their respective commands) here, or remove them from your README.md.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

"pretest": "npm run lint",
"test": "ava --verbose test/*.test.js"
Expand Down
2 changes: 1 addition & 1 deletion appengine/building-an-app/update/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Before you can run or deploy the sample, you need to do the following:

## Deploying to App Engine

npm run deploy
gcloud app deploy

## Running the tests

Expand Down
2 changes: 2 additions & 0 deletions appengine/building-an-app/update/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"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"
Expand Down
2 changes: 1 addition & 1 deletion appengine/building-an-app/update/test/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test.cb.serial(`should display form`, (t) => {
.get(`/submit`)
.expect(200)
.expect((response) => {
t.regex(response.text, /textarea name="message" placeholder="Message"/);
t.true(response.text.includes('textarea name="message" placeholder="Message"'));
})
.end(t.end);
});
Expand Down
6 changes: 4 additions & 2 deletions appengine/cloudsql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
This sample application shows how to use [Google Cloud SQL[[sql] for [MySQL][mysql]
on Google App Engine.

App Engine Standard 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 Standard][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 users: See tutorial [Using Cloud SQL for MySQL (App Engine Flexible Environment)][flex-tutorial] for more information on running and deploying this app.
[App Engine Flexible][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/
[mysql]: https://www.mysql.com/downloads/
[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
2 changes: 2 additions & 0 deletions appengine/cloudsql/app.flexible.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions appengine/cloudsql/app.standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: add a comment here telling users not to add this file to source control (if it has any sensitive passwords in it).

P.S: @michaelawyu please apply this change to any other relevant .yaml files in this PR. Thanks!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expand Down
8 changes: 5 additions & 3 deletions appengine/cloudsql_postgresql/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Cloud SQL for MySQL Node.js sample on App Engine flexible environment
# Cloud SQL for PostgresSQL Node.js sample on App Engine flexible environment
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: IIRC, it's PostgreSQL (extra S).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me and my fat fingers :( It's been fixed


This sample application shows how to use [Google Cloud SQL[[sql] for [PostgreSQL][postgres]
on Google App Engine.

App Engine Standard users: See tutorial [
[App Engine Standard][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 users: See tutorial [
[App Engine Flexible][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/
[postgres]: https://www.postgresql.org/download/
[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
2 changes: 2 additions & 0 deletions appengine/cloudsql_postgresql/app.flexible.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions appengine/cloudsql_postgresql/app.standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
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
Expand Down
5 changes: 4 additions & 1 deletion appengine/cloudtasks/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Node.js Google Cloud Tasks sample for Google App Engine

This sample application shows how to use [Google Cloud Tasks](https://cloud.google.com/cloud-tasks/)
on Google App Engine Node.js Standard Environment and Flexible Environment.
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
Expand Down Expand Up @@ -105,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
6 changes: 4 additions & 2 deletions appengine/datastore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
This sample application shows how to use Google Cloud Datastore on Google App
Engine.

App Engine Node.js Standard Environment users: See tutorial [Using Cloud Datastore][tutorial-std] for more information on running and deploying this app.
[App Engine Standard][appengine-std] users: See tutorial [Using Cloud Datastore][tutorial-std] for more information on running and deploying this app.

App Engine Node.js Flexible Environment users: See tutorial [Using Cloud Datastore][tutorial-flex] for more information on running and deploying this app.
[App Engine Flexible][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)
Expand Down Expand Up @@ -50,6 +50,8 @@ or with `yarn`:

See [Contributing][contributing].

[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
Expand Down
5 changes: 4 additions & 1 deletion appengine/errorreporting/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Node.js error reporting sample for Google App Engine

This sample shows how to use Stackdriver Error Reporting on Google App Engine
Node.js Standard Environment and Flexible Environment.
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
3 changes: 2 additions & 1 deletion appengine/loopback/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Refer to the [appengine/README.md](../README.md) file for more instructions on
running and deploying this app.

App Engine Node.js Flexible Environment users may also read the community
[App Engine Flexible][5] users may also read the community
tutorial [Loopback.js on App Engine Tutorial][2] for how to run and deploy this
sample app.

Expand All @@ -15,3 +15,4 @@ Additionally, view the [live demo][3] and read the [Loopback.js documentation][4
[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
8 changes: 5 additions & 3 deletions appengine/mailjet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

This sample application demonstrates how to use [Express.js][2] and
[node-mailjet][3] to send transactional email on [Google App Engine][4] Node.js
Standard Environment and Flexible Environment.
[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/
4 changes: 4 additions & 0 deletions appengine/mailjet/app.flexible.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
# [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: <your-mj-apikey-public>
MJ_APIKEY_PRIVATE: <your-mj-apikey-private>
Expand Down
3 changes: 3 additions & 0 deletions appengine/mailjet/app.standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# [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: <your-mj-apikey-public>
MJ_APIKEY_PRIVATE: <your-mj-apikey-private>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be checked into source control?

If so, perhaps we should add a comment telling people not to commit this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

Expand Down
7 changes: 5 additions & 2 deletions appengine/memcached/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Memcached sample for Google App Engine

This sample demonstrates accessing Memcached from Node.js on
[Google App Engine](https://cloud.google.com/appengine) Node.js Standard
Environment and Flexible Environment.
[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
3 changes: 3 additions & 0 deletions appengine/memcached/app.flexible.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions appengine/memcached/app.standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
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.
Expand Down
5 changes: 2 additions & 3 deletions appengine/metadata/standard/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ 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';
const METADATA_NETWORK_INTERFACE_URL = 'http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip';

function getExternalIp () {
const options = {
Expand All @@ -36,7 +35,7 @@ function getExternalIp () {
return request(METADATA_NETWORK_INTERFACE_URL, options)
.then((response) => response.body)
.catch((err) => {
if (err || err.statusCode !== 200) {
if (err && err.statusCode !== 200) {
console.log('Error while talking to metadata server, assuming localhost');
return 'localhost';
}
Expand Down
11 changes: 6 additions & 5 deletions appengine/mongodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
Refer to the [appengine/README.md](../README.md) file for more instructions on
running and deploying this app.

App Engine Node.js Flexible Environment users may also read the community
tutorial [MongoDB on App Engine Tutorial][2] for how to run and deploy this
[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][3].
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/
5 changes: 3 additions & 2 deletions appengine/parse-server/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Parse-server sample for Google App Engine

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 and Flexible Environment.
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

Expand Down
3 changes: 2 additions & 1 deletion appengine/pubsub/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Node.js Cloud Pub/Sub sample for Google App Engine

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 and Flexible Environment using Node.js.
[Standard Environment](https://cloud.google.com/appengine/docs/standard/nodejs)
and [Flexible Environment](https://cloud.google.com/appengine/docs/flexible/nodejs).

## Setup

Expand Down
11 changes: 6 additions & 5 deletions appengine/redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ used as database, cache and message broker.
Refer to the [appengine/README.md](../README.md) file for more instructions on
running and deploying this app.

App Engine Node.js Flexible Environment users may also read the community
tutorial [Redis on App Engine Tutorial][2] for how to run and deploy this sample
[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.

Additonally, 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
4 changes: 2 additions & 2 deletions appengine/sendgrid/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Node.js SendGrid email sample for Google App Engine

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 and Flexible Environment.
[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).
Expand Down
3 changes: 3 additions & 0 deletions appengine/sendgrid/app.flexible.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: <your-sendgrid-api-key>
SENDGRID_SENDER: <your-sendgrid-sender>
Expand Down
3 changes: 3 additions & 0 deletions appengine/sendgrid/app.standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
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: <your-sendgrid-api-key>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto to "do not commit this file" comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

SENDGRID_SENDER: <your-sendgrid-sender>
Expand Down
Loading